Issue #22557 has been updated by Andrew Parker.

I think I've tracked this down. The problem is happening in the `query` method 
in the dpkg provider. When it executes
<pre>
154     # list out our specific package
155     begin
156       self.class.dpkgquery_piped(
157         "-W",
158         "--showformat",
159         self.class::DPKG_QUERY_FORMAT_STRING,
160         @resource[:name]
161       ) do |pipe|
162         hash = self.class.parse_multi_line(pipe)
163       end
164     rescue Puppet::ExecutionFailure
165       # dpkg-query exits 1 if the package is not found.
166       return {:ensure => :purged, :status => 'missing', :name => 
@resource[:name], :error => 'ok'}
167     end
</pre>

Then the `dpkg_query_piped` works correctly, sets `hash`, and it ok. Then the 
control is returned to `execpipe`. `execpipe` gets an exit status that is not 
0, it actually shows up as 36096. Inspection of the `Process::Status` object 
(which is what `$CHILD_STATUS` is) shows that it is exiting with 141. After 
some experimentation this seems to be because it is not reading everything from 
the dpkg command

<pre>
irb(main):027:0> open("| /usr/bin/dpkg-query -W --showformat '${Status} 
${Package} ${Version} :DESC: ${Description}\n:DESC:\n' nagios-plugins 
nagios-nrpe-server") { |p| p.gets; p.gets
}
=> " Nagios is a host/service/network monitoring and management system.\n"
irb(main):028:0> $CHILD_STATUS
=> #<Process::Status: pid=15688,exited(141)>
irb(main):029:0> open("| /usr/bin/dpkg-query -W --showformat '${Status} 
${Package} ${Version} :DESC: ${Description}\n:DESC:\n' nagios-plugins 
nagios-nrpe-server") { |p| while !p.eof; p
.gets; end }
=> nil
irb(main):030:0> $CHILD_STATUS
=> #<Process::Status: pid=15691,exited(0)>
</pre>

What this tells me is that the `parse_multi_line` method needs to make sure it 
drains the rest of the pipe when it is done.


----------------------------------------
Bug #22557: Regression on arrays and puppet resources using the name attribute
https://projects.puppetlabs.com/issues/22557#change-97952

* Author: William Van Hevelingen
* Status: Investigating
* Priority: Normal
* Assignee: Andrew Parker
* Category: 
* Target version: 
* Affected Puppet version: 3.3.0
* Keywords: 
* Branch: 
----------------------------------------
Upgraded to Puppet 3.3.0 and started getting these errors.

Reporting broken for arrays on puppet resources using the name attribute.

<pre>
# puppet apply -e "package { 'nrpe': name => ['nagios-plugins', 
'nagios-nrpe-server'], ensure=>present } "
Notice: Compiled catalog for foo.lan in environment production in 1.72 seconds
Notice: /Stage[main]//Package[nrpe]/ensure: ensure changed 'purged' to 'present'
</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