Issue #22557 has been updated by Josh Partlow.

Status changed from Investigating to Needs More Information
Assignee changed from Andrew Parker to William Van Hevelingen

Hi William,

Following up on Andy's point, it does look like the fact that you could ever 
successfully submit an array of names to the dpkg provider is an implementation 
accident, and in fact will fail on 3.2.4 if you mix packages in different 
states, because, no matter what, query is operating on a single hash of final 
state.  It only works if both packages happen to have the same state.

For example:

    root@vom1yp3sdx3gcgm:~# puppet --version
    3.2.4

Using 3.2.4 I ensure tree and apg are present (they weren't to begin with):

    root@vom1yp3sdx3gcgm:~# puppet apply --debug -e "package { 'test': name => 
['tree', 'apg'], ensure=> present }"

    ...
    Info: Applying configuration version '1380159223'
    ...
    Debug: Prefetching apt resources for package
    Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} 
${Version}\n''
    Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} 
${Version}\n''
    Debug: Executing '/usr/bin/dpkg-query -W --showformat ${Status} ${Package} 
${Version}\n tree apg'
    Debug: Executing '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold 
install tree apg'
    Notice: /Stage[main]//Package[test]/ensure: created
    ...
    Notice: Finished catalog run in 1.77 seconds
    ...

And the packages are created.  Then I remove tree.

    root@vom1yp3sdx3gcgm:~# puppet apply --debug -e "package { 'test': name => 
['tree'], ensure=> absent }"

    ...

    Info: Applying configuration version '1380159310'
    ...
    Debug: Prefetching apt resources for package
    Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} 
${Version}\n''
    Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} 
${Version}\n''
    Debug: Executing '/usr/bin/apt-get -y -q remove tree'
    Notice: /Stage[main]//Package[test]/ensure: removed
    ...
    Notice: Finished catalog run in 1.30 seconds
    ...
    root@vom1yp3sdx3gcgm:~# tree
    -bash: /usr/bin/tree: No such file or directory

Then I repeat the first apply to ensure both tree and apg are present:

    root@vom1yp3sdx3gcgm:~# puppet apply --debug -e "package { 'test': name => 
['tree', 'apg'], ensure=> present }"

    ...

    Info: Applying configuration version '1380159404'
    ...
    Debug: Prefetching apt resources for package
    Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} 
${Version}\n''
    Debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} 
${Version}\n''
    Debug: Executing '/usr/bin/dpkg-query -W --showformat ${Status} ${Package} 
${Version}\n tree apg'
    ...
    Notice: Finished catalog run in 0.09 seconds
    ...

The tree package is not installed, because dpkg-query provides apg's output 
first, and that is matched by the provider  parser as 'ok' installed.

    root@vom1yp3sdx3gcgm:~# tree
    -bash: /usr/bin/tree: No such file or directory
    root@vom1yp3sdx3gcgm:~# apg
    
    Please enter some random data (only first 8 are significant)
    (eg. your old password):>
    squiralp3Oct (squir-alp-THREE-Oct)
    itvasaquiUp1 (it-vas-a-qui-Up-ONE)
    FercIph9 (Ferc-Iph-NINE)
    EbWuacyek0 (Eb-Wu-ac-yek-ZERO)
    porjyerbUt6 (porj-yerb-Ut-SIX)
    Libcyoj5 (Lib-cyoj-FIVE)

So it seems clear that this never worked in a reliable way.

The next question is, is this accidental functionality being depended on by 
anyone?  And are their alternative ways of handling this?

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

* Author: William Van Hevelingen
* Status: Needs More Information
* Priority: Normal
* Assignee: William Van Hevelingen
* 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 puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
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