Issue #21409 has been updated by Andrew Parker.
I just tried this out and got what I would expect:
<pre>
[11:32:06][Ruby(ruby-1.9.3-p392)][Git(master)] andy:puppet
> be puppet apply -e 'create_resources(exec,{"ls"=>{command=>"/bin/ls
> -l",logoutput=>true,provider=>shell}})'
Warning: Could not retrieve fact fqdn
Notice: /Stage[main]//Exec[ls]/returns: total 28520
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 11815
Jul 11 11:44 COMMITTERS.md
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 3084
Jun 12 14:11 CONTRIBUTING.md
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 2428
Jul 11 11:44 Gemfile
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 2239
Jul 13 11:32 Gemfile.lock
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 702
Apr 5 08:52 LICENSE
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 1909
Jun 12 14:11 README.md
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 27232
Jul 11 11:44 README_DEVELOPER.md
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 2136
Jul 13 11:31 Rakefile
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 6 andy staff 204
Jul 11 11:44 acceptance
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 45
Jun 28 09:29 auth.conf
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 7 andy staff 238
Feb 10 08:42 autotest
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 4 andy staff 136
Jun 12 14:11 bin
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 3 andy staff 102
Jun 24 12:07 bundle
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 5 andy staff 170
Jun 12 14:11 conf
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 3 andy staff 102
Apr 9 15:35 coverage
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 65 andy staff 2210
Apr 9 15:40 doc
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 10 andy staff 340
Jun 12 14:11 examples
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 34 andy staff 1156
Jul 13 11:31 ext
Notice: /Stage[main]//Exec[ls]/returns: -rwxr-xr-x 1 andy staff 13946
Jul 11 11:38 install.rb
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 7 andy staff 238
Jul 11 11:38 lib
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 4 andy staff 136
Mar 19 2012 man
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 3 andy staff 102
Jun 14 12:22 pkg
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 3372318
Jun 25 10:00 result.xml
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 11 andy staff 374
Jul 9 17:03 spec
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 26211
Jun 25 10:00 spec_order.txt
Notice: /Stage[main]//Exec[ls]/returns: -rw-r--r-- 1 andy staff 11109701
Jun 26 14:04 tags
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 4 andy staff 136
Jun 12 14:11 tasks
Notice: /Stage[main]//Exec[ls]/returns: drwxr-xr-x 3 andy staff 102
Jun 12 14:11 yardoc
Notice: /Stage[main]//Exec[ls]/returns: executed successfully
Notice: Finished catalog run in 0.15 seconds
</pre>
However, if this is based on the order that a hash is being iterated over, then
I can see this working sometimes and not others.
----------------------------------------
Bug #21409: create_resources ignore exec type's command attribute
https://projects.puppetlabs.com/issues/21409#change-94612
* Author: liu changyuan
* Status: Investigating
* Priority: Normal
* Assignee:
* 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.