Re: [Puppet Users] Re: Few questions about Puppet
Hi Rich, Thanks for the reply. May be I'm trying to do what puppet is not designed for. I had the requirement of replacing a directory with another directory and then run a script to test certain things with that directory content, and once that completed I wanted the same directory to be replaced with a completely different directory and run another script. The problem is how do I replace the same directory twice at two different times? That's why I told, this may not be achievable in puppet, because it's not designed to perform these sort of works. thanks, Shazni On Friday, October 25, 2013 4:32:03 AM UTC+5:30, Rich Burroughs wrote: It's not clear to me exactly what you're trying to do. Unless I'm misreading something, both of those file resources are exactly the same. I'm not sure why you would need to manage the same resource twice with the same settings, but as the earlier person said, you can't. Maybe part of the confusion comes from you thinking of manifests as scripts. They're not. With Puppet what you're doing is specifying what you want the running state of the system to be. And for a given resource, like a file, that's one state. And every time the agent runs, it will make sure the resource is in that state. In fact by default Puppet may not do things in a given manifest in the order that they appear in the manifest, unless you do something specifically to control that. There's a doc on resource ordering here: http://docs.puppetlabs.com/learning/ordering.html Rich On Wed, Oct 23, 2013 at 5:28 AM, shazni nazeer mshazn...@gmail.comjavascript: wrote: Thank Rahul for your responses. I would like to know how do I achieve my requirements. The second one seems a bit trickier On Wednesday, October 23, 2013 3:41:08 PM UTC+5:30, shazni nazeer wrote: Hi All, I'm new to puppet and I've three requirements to achieve using puppet. 1. I've a json file shown below that I need to modify, when I run my puppet script. { assets:{ ignore:[], icons:{ gadget:icon-dashboard, ebook :icon-ebook, site :icon-site, default:icon-dashboard } } } I need to add a new entry in the mid of icons, say a:b. How do I do this? 2. I replace a directory using another directory. And I need to do the same after doing some other additions to configuration. I get the following error when I apply the 'file resource twice. Duplicate declaration: File[/home/shazni/Documents/ Junk/wso2greg-4.6.0/samples/asset-models/ApplicationModel/] is already declared in file /home/shazni/.puppet/modules/gregstore/manifests/init.pp at line 85; cannot redeclare at /home/shazni/.puppet/modules/ gregstore/manifests/init.pp:108 on node wso2-thinkpad-t530.private. wso2.com My script does this. file { $StoreHome/repository/deployment/server/jaggeryapps/ store/extensions/assets/servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/ setup-beta2/store/servicex/, } // Some more work file { $StoreHome/repository/deployment/server/jaggeryapps/ store/extensions/assets/servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/ setup-beta2/store/servicex/, } How to solve this issue? 3. I want to run a script file, which in turn invoke some java class files. How to to do it in the same file? -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com javascript:. To post to this group, send email to puppet...@googlegroups.comjavascript: . Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a2db6aed-a5df-4946-994f-890e92278fff%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Puppet Users] Re: Few questions about Puppet
On Monday, November 11, 2013 3:30:36 AM UTC-6, shazni nazeer wrote: Hi Rich, Thanks for the reply. May be I'm trying to do what puppet is not designed for. I had the requirement of replacing a directory with another directory and then run a script to test certain things with that directory content, and once that completed I wanted the same directory to be replaced with a completely different directory and run another script. The problem is how do I replace the same directory twice at two different times? Puppet is not a script engine; it is a state management service. You describe a target machine state to Puppet, and Puppet puts the machine into that state. You cannot declare two different target states for the same physical resource because it does not make sense. The longstanding system design in fact enforces a stronger constraint that you cannot declare the same resource twice, even with the same properties. You cannot manage the same resource into two or more different states during the same Puppet run. You could conceivably perform multiple runs, perhaps selecting which test to perform via tags, but at that point you have to consider why you are using Puppet for the job instead of some other system for which it is a more natural fit. That's why I told, this may not be achievable in puppet, because it's not designed to perform these sort of works. Oh, it's achievable. At worst, you can write up a shell script that performs the whole job, including file manipulation, and have Puppet run it via an Exec resource. I think, however, that you might be looking for an automated testing framework as your top-level system. You could perhaps integrate Puppet into your system at a lower level, using it (say) on a per-test-case basis to set up your test fixtures. John -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4aee8fee-b74f-449a-80ce-c7fd76fbbe9c%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Puppet Users] Re: Few questions about Puppet
It's not clear to me exactly what you're trying to do. Unless I'm misreading something, both of those file resources are exactly the same. I'm not sure why you would need to manage the same resource twice with the same settings, but as the earlier person said, you can't. Maybe part of the confusion comes from you thinking of manifests as scripts. They're not. With Puppet what you're doing is specifying what you want the running state of the system to be. And for a given resource, like a file, that's one state. And every time the agent runs, it will make sure the resource is in that state. In fact by default Puppet may not do things in a given manifest in the order that they appear in the manifest, unless you do something specifically to control that. There's a doc on resource ordering here: http://docs.puppetlabs.com/learning/ordering.html Rich On Wed, Oct 23, 2013 at 5:28 AM, shazni nazeer mshazninaz...@gmail.comwrote: Thank Rahul for your responses. I would like to know how do I achieve my requirements. The second one seems a bit trickier On Wednesday, October 23, 2013 3:41:08 PM UTC+5:30, shazni nazeer wrote: Hi All, I'm new to puppet and I've three requirements to achieve using puppet. 1. I've a json file shown below that I need to modify, when I run my puppet script. { assets:{ ignore:[], icons:{ gadget:icon-dashboard, ebook :icon-ebook, site :icon-site, default:icon-dashboard } } } I need to add a new entry in the mid of icons, say a:b. How do I do this? 2. I replace a directory using another directory. And I need to do the same after doing some other additions to configuration. I get the following error when I apply the 'file resource twice. Duplicate declaration: File[/home/shazni/Documents/** Junk/wso2greg-4.6.0/samples/**asset-models/ApplicationModel/**] is already declared in file /home/shazni/.puppet/modules/**gregstore/manifests/init.pp at line 85; cannot redeclare at /home/shazni/.puppet/modules/** gregstore/manifests/init.pp:**108 on node wso2-thinkpad-t530.private.** wso2.com http://wso2-thinkpad-t530.private.wso2.com My script does this. file { $StoreHome/repository/**deployment/server/jaggeryapps/** store/extensions/assets/**servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/** setup-beta2/store/servicex/, } // Some more work file { $StoreHome/repository/**deployment/server/jaggeryapps/** store/extensions/assets/**servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/** setup-beta2/store/servicex/, } How to solve this issue? 3. I want to run a script file, which in turn invoke some java class files. How to to do it in the same file? -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet Users] Re: Few questions about Puppet
Hi Shazni, 1. I've a json file shown below that I need to modify, when I run my puppet script. { assets:{ ignore:[], icons:{ gadget:icon-dashboard, ebook :icon-ebook, site :icon-site, default:icon-dashboard } } } I need to add a new entry in the mid of icons, say a:b. How do I do this? In this case you can explore the puppet *augeas* resource type. It will allow you to change the file contents. But you have to learn the augeas tool format. Refer, http://docs.puppetlabs.com/references/latest/type.html#augeas http://projects.puppetlabs.com/projects/1/wiki/puppet_augeas#Using+Puppet+with+Augeas 2. I replace a directory using another directory. And I need to do the same after doing some other additions to configuration. I get the following error when I apply the 'file resource twice. Duplicate declaration: File[/home/shazni/Documents/Junk/wso2greg-4.6.0/samples/asset-models/ApplicationModel/] is already declared in file /home/shazni/.puppet/modules/gregstore/manifests/init.pp at line 85; cannot redeclare at /home/shazni/.puppet/modules/gregstore/manifests/init.pp:108 on node wso2-thinkpad-t530.private.wso2.com My script does this. file { $StoreHome/repository/deployment/server/jaggeryapps/store/extensions/assets/servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/setup-beta2/store/servicex/, } // Some more work file { $StoreHome/repository/deployment/server/jaggeryapps/store/extensions/assets/servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/setup-beta2/store/servicex/, } How to solve this issue? puppet does not allow you to perform operation on same file twice in manifests. You have to do the all operations on single file in one file resource(*Exactly once*) 3. I want to run a script file, which in turn invoke some java class files. How to to do it in the same file? Transfer the script file to puppet agent/client using *FILE* resource and then use *EXEC* resource to execute that script file. Hope this will help. Thanks and Regards, Rahul Khengare NTT DATA OSS Center, Pune, India. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet Users] Re: Few questions about Puppet
Thank Rahul for your responses. I would like to know how do I achieve my requirements. The second one seems a bit trickier On Wednesday, October 23, 2013 3:41:08 PM UTC+5:30, shazni nazeer wrote: Hi All, I'm new to puppet and I've three requirements to achieve using puppet. 1. I've a json file shown below that I need to modify, when I run my puppet script. { assets:{ ignore:[], icons:{ gadget:icon-dashboard, ebook :icon-ebook, site :icon-site, default:icon-dashboard } } } I need to add a new entry in the mid of icons, say a:b. How do I do this? 2. I replace a directory using another directory. And I need to do the same after doing some other additions to configuration. I get the following error when I apply the 'file resource twice. Duplicate declaration: File[/home/shazni/Documents/Junk/wso2greg-4.6.0/samples/asset-models/ApplicationModel/] is already declared in file /home/shazni/.puppet/modules/gregstore/manifests/init.pp at line 85; cannot redeclare at /home/shazni/.puppet/modules/gregstore/manifests/init.pp:108 on node wso2-thinkpad-t530.private.wso2.com My script does this. file { $StoreHome/repository/deployment/server/jaggeryapps/store/extensions/assets/servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/setup-beta2/store/servicex/, } // Some more work file { $StoreHome/repository/deployment/server/jaggeryapps/store/extensions/assets/servicex: ensure = directory, recurse = true, purge = true, force = true, source = puppet:///modules/gregstore/setup-beta2/store/servicex/, } How to solve this issue? 3. I want to run a script file, which in turn invoke some java class files. How to to do it in the same file? -- You received this message because you are subscribed to the Google Groups Puppet Users group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.