ryanuber / puppet-packagelist

Dynamically create package resources from lists
MIT License
6 stars 4 forks source link

Issue with Packagelist not updating packages #4

Open tman77 opened 10 years ago

tman77 commented 10 years ago

I installed your module on both puppetmaster and a test node. These are both RedHat 6 EL servers. I included a line on the nodes.pp manifests on the puppetmaster to call the packagelist.

I call it via: packagelist { '/etc/puppetlabs/puppet/test1.packagelist': }

The contents of the file are two packages pertaining to man-pages. One with a version and one without, I wanted to make sure it would update the one without a version and leave the other one alone, see below:

man-pages-3.22-20.el6.noarch man-pages-overrides

When I run puppet agent --test --debug

Debug: Adding 2 package resources from package list
Debug: Prefetching yum resources for package
Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n''
Debug: Executing '/bin/rpm -q man-pages-overrides --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n'
Debug: file_metadata supports formats: pson b64_zlib_yaml yaml raw
Debug: Executing '/bin/rpm -q man-pages --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n'
Debug: file_metadata supports formats: pson b64_zlib_yaml yaml raw

But the package man-pages-overrides isn't updated, even though yum install man-pages-overrides specifies the package level will be updated from 0:6.4.1-1.el6 to 0:6.5.2-1.el6

Do you have any ideas as to how to get it to update this package?

Thank you, Taylor

ryanuber commented 10 years ago

@tman77,

I gave this scenario a quick test using a CentOS 6.5 puppet vagrant box for both master and agent. The box I used can be found here.

I noticed that the wget package was not the latest version, so I figured this would be a good package to try upgrading with puppet-packagelist by not providing an explicit version.

On the master:

[root@master ~]# puppet module list
/etc/puppet/modules
└── ryanuber-packagelist (v0.2.7)
/usr/share/puppet/modules (no modules installed)

[root@master ~]# cat /etc/puppet/manifests/site.pp 
packagelist { '/root/list.txt': }

On the agent:

[root@agent ~]# cat /root/list.txt 
wget

[root@agent ~]# puppet agent --test --debug
...
...
Debug: Adding 1 package resources from package list
Debug: Prefetching yum resources for package
Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n''
Debug: Executing '/usr/bin/python /usr/lib/ruby/site_ruby/1.8/puppet/provider/package/yumhelper.py'
Debug: /Stage[main]/Main/Package[wget]/ensure: wget "1.12-1.8.el6" is installed, latest is "0:1.12-1.11.el6_5"
Debug: Package[wget](provider=yum): Ensuring => latest
Debug: Executing '/usr/bin/yum -d 0 -e 0 -y install wget'
Debug: Executing '/bin/rpm -q wget --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n'
Notice: /Stage[main]/Main/Package[wget]/ensure: ensure changed '1.12-1.8.el6' to '0:1.12-1.11.el6_5'

Is there anything special about the man page overrides package? Maybe some conflicts, etc? Would you mind posting your manifest?

As far as I can tell, things seem to be working normally.

Thanks for the report! Hope we can get this resolved for you.

tman77 commented 10 years ago

Ryan, thank you for the reply, I appreciate the help.

Here is the relevant portion of the manifest:

node 'test1.domain.com' { file { "/etc/puppetlabs/puppet/test1.rpmlists": ensure => present, source => "puppet:///modules/etc/test1.rpmlists" } packagelist { '/etc/puppetlabs/puppet/test1.rpmlists': require => File["/etc/puppetlabs/puppet/test1.rpmlists"] } } #end of node definition

Ok, I ran yum update man-pages-overrides on another identical test server, it updated with no problems.

I noticed in my debug log output, it never proceeds to the yumhelper.py line. So I tried removing the man-pages-overrides package, and on the next run it did install the latest version.

I removed it again, and ran the puppet agent --test --debug and I saw the following:

Debug: Adding 2 package resources from package list
Debug: Prefetching yum resources for package
Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n''
Debug: Executing '/bin/rpm -q man-pages-overrides --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n'
Debug: Package[man-pages-overrides](provider=yum): Ensuring => latest
Debug: Executing '/usr/bin/yum -d 0 -e 0 -y install man-pages-overrides'
Debug: Executing '/bin/rpm -q man-pages-overrides --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\n'
Notice: /Stage[main]//Node[test1.domain.com]/Package[man-pages-overrides]/ensure: created
Debug: /Stage[main]//Node[test1.domain.com]/Package[man-pages-overrides]: The container /etc/puppetlabs/puppet/test1.rpmlists will propagate my refresh event

So it appears if a package is listed in the list file, and not installed on the system it will install the latest version. But if an existing package is on the system and a version is unspecified, it will not update it.

As another test, I added wget to the packagelist file without a version. It was not at the latest version. Same behavior, it saw the package in the list, but did not apply the update.

I wonder if this must be something specific to RedHat EL 6.4 (Santiago).

ryanuber commented 10 years ago

One other thing you might try would be to try running with a manifest like:

package { 'man-pages-overrides': ensure => latest }

and see if the package would be successfully updated in that case. Considering the packagelist code here, the package should always be emitted into the catalog as "latest" if it does not match name-version-release.arch format.

If you have a chance, give that a rip. If it upgrades normally, then perhaps there is still something going on with packagelist. If you see the same problem though, then maybe there is a difference in the YUM provider or similar.

I'll check back on this after work today.

tman77 commented 10 years ago

Ok, well I removed the man-pages-overrides, and then re-installed the old version (6.4.1). I removed it from the packagelist file, and added the package line you suggested above into my manifest. On the next subsequent run, it did indeed update it from 6.4.1 to 6.5.2. Please see attached log output from puppet master.

notice  ensure changed '6.4.1-1.el6' to '0:6.5.2-1.el6' /Stage[main]//Node[test1.domain.com]/Package[man-pages-overrides]/ensure /etc/puppetlabs/puppet/manifests/nodes.pp  204 2014-03-05 12:56 EST

I did one more test. I again removed man-pages-overrides. I installed the 6.4.1 version. I comented out the puppet package definition you suggest above. And in the packagelist file this time I specified package-list-overrides-6.5.2-1.el6.noarch. The puppet agent ran and it updated the package to the specified version.

So the following is occurring on my test server:

  1. The puppet core package type works as expected.
  2. Packagelist will install the software package if it is missing from the system, version or no version.
  3. Packagelist will update a package if a later version then what is installed on the system is specified.
  4. Packagelist will not update a non-latest package if no version is specified.

Please let me know if any of the above is not clear. I think we have it narrowed down to only one scenario where it doesn't work as expected/documented on this platform.

ryanuber commented 10 years ago

Hey @tman77,

I gave this another go using the exact package in your scenario, man-pages-overrides. I first installed the el6.4 version, then had packagelist do the update for me.

[root@agent ~]# rpm -q man-pages-overrides
man-pages-overrides-6.4.1-1.el6.noarch

[root@agent ~]# cat list.txt 
man-pages-overrides

[root@agent ~]# puppet apply -e 'packagelist { "/root/list.txt": }'
Notice: Compiled catalog for agent in environment production in 0.03 seconds
Notice: /Stage[main]/Main/Package[man-pages-overrides]/ensure: ensure changed '6.4.1-1.el6' to '0:6.5.2-1.el6'
Notice: Finished catalog run in 9.89 seconds

I tested this with an agent-master setup as well (the above is just a puppet apply). Both scenarios seem to work out.

The only thing I can think of now is some difference between CentOS => RHEL, perhaps YUM, Puppet, or RPM defaults differ from one to the other.

Unfortunately, there are no (legally) available RHEL vagrant boxes due to licensing restrictions, AFAIK, so I couldn't test this on actual RHEL.

I made a new minor release of the module, which should emit into the debug log what packagelist is going to enforce for each pacakge. If you install the new module and run it, you should see something like:

Debug: /Stage[main]/Main/Packagelist[/root/list.txt]: ensuring man-pages-overrides => latest

Then when the actual package is evaluated from the catalog, you should see:

Debug: Package[man-pages-overrides](provider=yum): Ensuring => latest

Let me know if either of these come back different.

tman77 commented 10 years ago

Ok, now I am completely baffled. I upgraded to the new version of packagelist. I removed the newer version of man-pages-overrides, installed the older version, and set the packagelist to just list man-pages-overrides with no version.

I ran the following from the command line on the agent node and received the following output:

/usr/local/bin/puppet apply -e 'packagelist { "/etc/puppetlabs/puppet/test1.rpmlists": }'
Notice: Compiled catalog for test1.domain.com in environment production in 0.16 seconds
Notice: /Stage[main]//Package[man-pages-overrides]/ensure: ensure changed '6.4.1-1.el6' to '0:6.5.2-1.el6'
Notice: Finished catalog run in 60.43 seconds

And rpm -qa showed the new version was installed. So I removed the new version and installed old version again, and waited to see what would happen on the scheduled run of the agent, and to check the node's ouput log on the puppet-master.

Same result as before. This time there was no mention in the log output of applying any package update, and the man-pages-overrides package was unchanged, left at the older version.

If I run puppet agent --test --debug, it shows the package is detected, And I do see this line:

Debug: /Stage[main]//Node[test1.domain.com]/Packagelist[/etc/puppetlabs/puppet/test1.rpmlists]: ensuring man-pages-overrides => latest

But the package isn't actually updated.

So now its down to, if puppet agent is manually called on the agent node and packagelist is passed, it works, but if it runs as scheduled via agent update it doesn't update the package.

ryanuber commented 10 years ago

Hey @tman77, were you able to get this going?

If you haven't had any luck, could you let me know what version of Puppet you were running on agent and master? Is there anything else atypical about your setup or any other configuration on the agent or master that might alter this behavior? I've tried a few times and I am still unable to reproduce this issue on CentOS 6.5 and Scientific Linux 6.5.

tman77 commented 10 years ago

Ryan, no, still not able to get it going. Puppet Version is 3.3.3 (Puppet Enterprise 3.1.3) on agent and master. If it would be helpful I can probably arrange for you to have access on a redhat machine, its a test machine so no issues with providing access. Also, I need to test calling the packagelist apply on the agent from a cron-job, but if that worked (I suspect it will since it worked from command line above) then at least there is a bit of a work-around.