|
Puppet seems to behave very differently when querying some types from the command line for resources that don't exist. For example, on ubuntu 12.04...
root@wzt7vze95hmfvb5:~# puppet resource service foo-bar
|
Error: Could not run: Could not find init script or upstart conf file for 'foo-bar'
|
root@wzt7vze95hmfvb5:~# echo $?
|
1
|
root@wzt7vze95hmfvb5:~# puppet resource user foo-bar
|
user { 'foo-bar':
|
ensure => 'absent',
|
}
|
root@wzt7vze95hmfvb5:~# echo $?
|
0
|
In this case, foo-bar doesn't exist as either a service or user. Puppet returns non-zero for the service, but 0 for the user.
On redhat 7:
[matthaus@fontana ~]$ puppet resource service foo-bar
|
service { 'foo-bar':
|
ensure => 'stopped',
|
enable => 'false',
|
}
|
[matthaus@fontana ~]$ echo $?
|
0
|
[matthaus@fontana ~]$ puppet resource user foo-bar
|
Error: Could not run: undefined method `exists?' for nil:NilClass
|
[matthaus@fontana ~]$ echo $?
|
1
|
On redhat 7 the non-existent service returns 0 while the non-existent user returns non-zero.
Ideally puppet would return 0 in all of these cases and simply indicate that the resource is absent (or whatever the service equivalent is).
|