Issue #21409 has been updated by Andrew Parker.

Assignee set to Andrew Parker

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

* Author: liu changyuan
* Status: Investigating
* Priority: Normal
* Assignee: Andrew Parker
* Category: 
* Target version: 
* Affected Puppet version: 3.2.2
* 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:
<pre>puppet apply -e 'create_resources(exec,{"ls"=>{command=>"/bin/ls 
-l",logoutput=>true,provider=>shell}})'</pre>

the result is:
<pre>
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
</pre>

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

  1. command => /bin/ls -l
  2. provider => shell
  3. name => ls
  4. 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.
<pre>puts p.to_s + " => " + v.to_s + ", result is: " + result.inspect</pre>

run the command again, the printed debug info is.
<pre>
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}
</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 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