Re: [Puppet Users] Augeas: Duplicate declaration
Almost there! =) My only change was 'host_entry_${name} :' like you suggested, everything else in the code is like my first post, and the error now is: *Could not evaluate: uninitialized constant Augeas::NO_MODL_AUTOLOAD* *By the way, thank you so much for the help, this topic made me learn a lot about puppet =)* On Saturday, January 18, 2014 10:18:06 PM UTC-2, Nick Cammorato wrote: Sorry, didn't realize it was a hash of hashes. You just need the augeas resource to have a unique name - entry[$name][hostname] or ipaddress should work. IE: define a_thing { augeas { 'host_entry': } } a_thing { 'a': } a_thing { 'b': } Will generate an error like you are seeing. define a_thing { augeas { host_entry_${name}: } } a_thing {'a': } a_thing {'b': } Will not. On Fri, Jan 17, 2014 at 1:07 PM, Andrey Kozichev akoz...@gmail.comjavascript: wrote: ah, right you are supplying entire hash in your defined resource. Missed it. If your defined resource would accept: name, iphost and hostname - then you can use create_resources to define all 3 entry. On 17 Jan 2014 15:21, Reinaldo Lima reim...@gmail.com javascript: wrote: With create_resources the error is: *Invalid parameter hostName on node* And including the entry[name] in the resource name: *Resource title must be a String, not Hash* =( On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote: another option to use create_resources('hostinclude',$netentry) On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com wrote: Your augeas resource is always called hosts_include which is why it's doing that. Try including the entry[name] in that resource name. On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com wrote: Hi Everyone, I'm trying to write a class that put some entries in /etc/hosts file as follow below: *class hosts {* *$netentry = {* *host01 = { iphost = '192.168.10.1', hostName = host01 },* *host02 = { iphost = '192.168.10.2', hostName = host02 },* *host03 = { iphost = '192.168.10.3', hostName = host03 },* *}* *define hostsinclude ($entry) {* * augeas { hosts_include:* * incl = /etc/hosts,* * lens = Hosts.lns,* * changes = [* * set /files/etc/hosts/01/ipaddr $entry[$name]['iphost'],* * set /files/etc/hosts/01/canonical$entry[$name]['hostName'],* * ],* * onlyif = match */ipaddr[ . = $entry[$name]['iphost'] ] size == 0* * }* *}* *hostsinclude { [* *'host01',* *'host02',* *'host03'* *]:* *entry = $netentry* *}* *}* and, when puppet compiles the manifest, I get the following error: *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in file /puppet/environments/production/modules/checklist/manifests/hosts.pp at line 10; cannot redeclare at /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on node* Someone can help me? Thanks -- 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. To view this discussion on the web visit https://groups.google.com/d/ msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9% 40googlegroups.com. 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...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/ msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_ GvAAXM%2BC8t3FC9xA%40mail.gmail.com. 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...@googlegroups.com javascript:. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com . 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...@googlegroups.com javascript:. To view this discussion on the web visit https
Re: [Puppet Users] Augeas: Duplicate declaration
With create_resources the error is: *Invalid parameter hostName on node* And including the entry[name] in the resource name: *Resource title must be a String, not Hash* =( On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote: another option to use create_resources('hostinclude',$netentry) On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com javascript: wrote: Your augeas resource is always called hosts_include which is why it's doing that. Try including the entry[name] in that resource name. On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com javascript: wrote: Hi Everyone, I'm trying to write a class that put some entries in /etc/hosts file as follow below: *class hosts {* *$netentry = {* *host01 = { iphost = '192.168.10.1', hostName = host01 },* *host02 = { iphost = '192.168.10.2', hostName = host02 },* *host03 = { iphost = '192.168.10.3', hostName = host03 },* *}* *define hostsinclude ($entry) {* * augeas { hosts_include:* * incl = /etc/hosts,* * lens = Hosts.lns,* * changes = [* * set /files/etc/hosts/01/ipaddr $entry[$name]['iphost'],* * set /files/etc/hosts/01/canonical$entry[$name]['hostName'],* * ],* * onlyif = match */ipaddr[ . = $entry[$name]['iphost'] ] size == 0* * }* *}* *hostsinclude { [* *'host01',* *'host02',* *'host03'* *]:* *entry = $netentry* *}* *}* and, when puppet compiles the manifest, I get the following error: *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in file /puppet/environments/production/modules/checklist/manifests/hosts.pp at line 10; cannot redeclare at /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on node* Someone can help me? Thanks -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com . 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...@googlegroups.com javascript:. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_GvAAXM%2BC8t3FC9xA%40mail.gmail.com . 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/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Puppet Users] Re: Passing hash as parameters to manifest
Nan Liu, this help me A LOT, thank you so much! On Thursday, August 11, 2011 11:11:31 PM UTC-3, Nan Liu wrote: On Thu, Aug 11, 2011 at 7:19 PM, treydock trey...@gmail.com javascript: wrote: Looking up the use of create_resources which is mentioned in the bug you linked, looks like it's available only in 2.7.x. I'm currently running 2.6.9, but may be worth upgrading for. Pretty sure you can be backport to 2.6 since it's just a function: https://github.com/puppetlabs/puppetlabs-create_resources I tried you suggestion, but get this error... err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid tag dump_dir/backups/redmine- sqldumpsdatabasesredminebackup_dir/var/www/rails/redmine at /etc/ puppet/modules/backuppc/manifests/definitions/sqldump.pp:11 on node ... Can't say for sure without more code, but this simple example should demonstrate how this works: $myhash = { var1 = { message = 'hi' }, var2 = { message = 'bye' } } define my_notify ($var) { notify { $name: message = $var[$name]['message'] } } my_notify { ['var1', 'var2']: var = $myhash } Also I am not sure what you mean by functions that get an array of first level hash keys. I mean if you need this to work with any hash without manually providing an array of resource titles write a custom puppet function that returns hash keys as a custom puppet function. Thanks, Nan -- 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/1d28b4c4-2d57-4309-86f5-659a8770cb29%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Puppet Users] Augeas: Duplicate declaration
Hi Everyone, I'm trying to write a class that put some entries in /etc/hosts file as follow below: *class hosts {* *$netentry = {* *host01 = { iphost = '192.168.10.1', hostName = host01 },* *host02 = { iphost = '192.168.10.2', hostName = host02 },* *host03 = { iphost = '192.168.10.3', hostName = host03 },* *}* *define hostsinclude ($entry) {* * augeas { hosts_include:* * incl = /etc/hosts,* * lens = Hosts.lns,* * changes = [* * set /files/etc/hosts/01/ipaddr $entry[$name]['iphost'],* * set /files/etc/hosts/01/canonical$entry[$name]['hostName'],* * ],* * onlyif = match */ipaddr[ . = $entry[$name]['iphost'] ] size == 0* * }* *}* *hostsinclude { [* *'host01',* *'host02',* *'host03'* *]:* *entry = $netentry* *}* *}* and, when puppet compiles the manifest, I get the following error: *err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in file /puppet/environments/production/modules/checklist/manifests/hosts.pp at line 10; cannot redeclare at /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on node* Someone can help me? Thanks -- 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/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.