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 "aaaaa":"bbbbb". 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.

Reply via email to