Issue #8940 has been updated by Rob Terhaar.

Thanks Stefan,
I tried overriding the namevar with a parameter, but that fails with a "cannot 
reassign, namer already taken" error. Sorry I can't dig up the actual error, 
I'm traveling for a few weeks and am away from the lab.
----------------------------------------
Feature #8940: host type should have an optional canonical_hostname parameter
https://projects.puppetlabs.com/issues/8940

Author: Rob Terhaar
Status: Needs More Information
Priority: Normal
Assignee: Nigel Kersten
Category: 
Target version: 
Affected Puppet version: 2.6.8
Keywords: 
Branch: 


If you compare the behavior of the Exec type to the Host type, Exec is more 
flexible because it has a command => parameter. This is useful if you would 
like to create multiple Execs with different namevars, but similar commands. 

When working with the Host type, I've found that the namevar becomes the 
"canonical_hostname", and there is no way to override this. Here's a specific 
example of when having multiple Host resources with the same namevar would be 
useful:

<pre>
  @@host  { "$fqdn":
    host_aliases  => $hostname,
    ip            => $private_ip_interface,
    tag           => "normal_server_private-${region}",
  }

  @@host  { "${fqdn}":
    host_aliases  => $hostname,
    ip            => $public_ip_interface,
    tag           => "normal_server_public-${region}",
  }
</pre>

Since both exported resources have the same namevar, I receive a parse error:
<pre>Error 400 on SERVER: Duplicate definition: Host[puppet.dev.server.com] is 
already defined in file /etc/puppet/modules/hosts/manifests/collect.pp at line 
33; cannot redefine at /etc/puppet/modules/hosts/manifests/collect.pp:43 on 
node puppet.dev.server.com</pre>

However, If the Host type had the ability to pass a canonical hostname (fqdn) 
argument, I could do:
<pre>
  @@host  { "${fqdn}-private":
    canonical_hostname => $fqdn
    host_aliases  => $hostname,
    ip            => $private_ip_interface,
    tag           => "normal_server_private-${region}",
  }

  @@host  { "${fqdn}-public":
    canonical_hostname => $fqdn
    host_aliases  => $hostname,
    ip            => $public_ip_interface,
    tag           => "normal_server_public-${region}",
  }
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to