Issue #21409 has been reported by liu changyuan.

----------------------------------------
Bug #21409: create_resources ignore exec type's command attribute
https://projects.puppetlabs.com/issues/21409

* Author: liu changyuan
* Status: Unreviewed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
my environment is 
CentOS 6.4
Ruby 1.8.7-352
Puppet 3.2.2
installed by rpm packages.

yesterday, i used enc program to call create_resources function, then i found a 
bug here.
just for test, when i use this command:
puppet apply -e 'create_resources(exec,{"ls"=>{command=>"/bin/ls 
-l",logoutput=>true,provider=>shell}})'

the result is:
Notice: /Stage[main]//Exec[ls]/returns: anaconda-ks.cfg
Notice: /Stage[main]//Exec[ls]/returns: foreman-1.1stable-3.el6.noarch.rpm
Notice: /Stage[main]//Exec[ls]/returns: 
foreman-release-1.1stable-3.el6.noarch.rpm
Notice: /Stage[main]//Exec[ls]/returns: install.log
Notice: /Stage[main]//Exec[ls]/returns: install.log.syslog
Notice: /Stage[main]//Exec[ls]/returns: executed successfully
Notice: Finished catalog run in 0.22 seconds

it's not looks like 'ls -l' style.

i checked the source code, and that it seems because when puppet creating the 
exec resources, the sequence of  assign the values to attributes was
command => /bin/ls -l
provider => shell
name => ls
logoutput =>true

the command attribute was assigned before then name, and when name attribute 
was assigning, the command attribute will be replaced to 'ls'.

i added a puts line after /usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb 
218 line , to print some debug info.
      puts p.to_s + " => " + v.to_s + ", result is: " + result.inspect

run the command again, the printed debug info is.
command => /bin/ls -l, result is: Exec[ls]{:command=>"/bin/ls -l"}
provider => shell, result is: Exec[ls]{:command=>"/bin/ls -l", 
:provider=>"shell"}
name => ls, result is: Exec[ls]{:command=>"ls", :provider=>"shell"}
logoutput => true, result is: Exec[ls]{:command=>"ls", :provider=>"shell", 
:logoutput=>true}




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to