Issue #18093 has been updated by Stefan Schulte.
Status changed from Unreviewed to Needs More Information
Assignee set to Guillaume Fenollar
I am not able to reproduce the error and the following example works for me:
<pre>
$ cat test.pp
$state = $hostname ? {
host1 => 'present',
host2 => 'present',
default => 'absent',
}
user {'username':
ensure => $state,
}
$ puppet apply test.pp
Info: Applying configuration version '1355437740'
Finished catalog run in 0.26 seconds
</pre>
Is your selector inside or outside your class? What is the name of your class
and the filename where you class is defined? Can post the content of your
classfile? Maybe there is a typo in your selector and puppet just gives a
misleading error message?
----------------------------------------
Bug #18093: Case and selectors don't work
https://projects.puppetlabs.com/issues/18093#change-78825
Author: Guillaume Fenollar
Status: Needs More Information
Priority: Normal
Assignee: Guillaume Fenollar
Category: modules
Target version:
Affected Puppet version: 2.6.2
Keywords: case,selector,ensure
Branch:
Hello, I'm trying to do something like this:
user{'username':
ensure=>"$state",
(...),
}
To guess the value of $state, I tried to use selectors and case matching
following the documentation , with no success.
In the top of my class, I added this case :
case $hostname {
host1: { $state = "present" }
host2: { $state = "present" }
default: { $state = "absent" }
}
As you understand, I just want to be sure this user will be absent on every
agents, except those I tell. I also tried selectors:
$state = $hostname ? {
host1 => 'present',
host2 => 'present',
default => 'absent',
}
Everytime, I got a "Error 400 on SERVER: Could not find class myclass::username
in namespaces myclass".
I verified that the rest of the class file is ok. Everything works if I comment
the selectors (or case) block, and replacing the "ensure=>$state" by
"ensure=>absent". It proves that my selectors/case blocks are not understood by
puppet (or the ensure=>$state) and that's pretty frustrating.
Sorry if it's a well known issue, and thanks for the investigation!
Regards
--
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.