----
It's entirely possible to have something blocking the run of 'apt-get -y upgrade' such as unresolved dependencies which may require you to execute 'apt-get -f install' in order to get something done.
Generally, you can check the result of a command by typing 'echo $?' to see the exit status... ie
apt-get upgrade -y; echo $?
as for your particular issue... hard to know for sure but it may be useful to see how I handle this. In a general explanation, I create a directory /etc/puppet/deployment_files and in that directory, I sometimes put things I need for deployment status or triggering.
This is what my 'apt updates' class looks like...
class apt::updates {
include mod_puppet::deployment_files
# Puppet maintained file /etc/puppet/deployment_files/apt_update_initiator
file { "/etc/puppet/deployment_files/apt_update_initiator":
source => "puppet://puppet/modules/apt/apt_update_initiator",
require => Class["mod_puppet::deployment_files"],
ensure => present,
owner => root,
group => root,
mode => 0644,
}
exec { "/usr/bin/aptitude update":
refreshonly => true,
subscribe => File["/etc/puppet/deployment_files/apt_update_initiator"],
}
# Puppet maintained file /etc/puppet/deployment_files/apt_safe_upgrade_initiator
file { "/etc/puppet/deployment_files//apt_safe_upgrade_initiator":
source => "puppet://puppet/modules/apt/apt_safe_upgrade_initiator",
require => [ Class["mod_puppet::deployment_files"], Exec["/usr/bin/aptitude update"] ],
ensure => present,
owner => root,
group => root,
mode => 0644,
}
exec { "/usr/bin/aptitude -y safe-upgrade":
refreshonly => true,
subscribe => File["/etc/puppet/deployment_files/apt_safe_upgrade_initiator"],
}
# Puppet maintained file /etc/puppet/deployment_files/apt_full_upgrade_initiator
file { "/etc/puppet/deployment_files/apt_full_upgrade_initiator":
source => "puppet://puppet/modules/apt/apt_full_upgrade_initiator",
require => [ Class["mod_puppet::deployment_files"], Exec["/usr/bin/aptitude update"] ],
ensure => present,
owner => root,
group => root,
mode => 0644,
}
exec { "/usr/bin/aptitude -y full-upgrade":
refreshonly => true,
subscribe => File["/etc/puppet/deployment_files/apt_full_upgrade_initiator"],
}
}
and so I '/bin/date > /etc/puppet/modules/apt/files/apt_update_initiator' ( and also to apt_safe_upgrade_initiator and apt_full_upgrade_initiator ) and the first time this is deployed, all three files are copied and the commands are executed on each client. Note that 'Exec["/usr/bin/aptitude update"]' is required by the 'upgrades'
Then I have a cron run every night to put the date into the apt_update_initiator file on the puppet master so that forces each puppet client to execute and I can do the same to either of the 'upgrade' files to force them to upgrade.
On any client, I can check /etc/puppet/deployment_files/apt_[update|safe_upgrade|full_upgrade]_initiator to see the date and time I last instructed it to update/upgrade.
Craig
Do you use unsigned repositories?
There isn't a problem with the "apt-get upgrade -y" command, because as i wrote in the original post, If i run that exact same command on the machine it works just fine.
Here's the output of the "apt-get upgrade -y; echo $?"
root@agent3:~# apt-get upgrade -y; echo $?Reading package lists... DoneBuilding dependency treeReading state information... DoneThe following packages will be upgraded:ca-certificates capplets-data checkbox checkbox-gtk dbus dbus-x11dhcp3-client dhcp3-common firefox firefox-branding firefox-gnome-supportfoomatic-filters gnome-control-center libdbus-1-3 libgnome-window-settings1libgtk-vnc-1.0-0 libnss3-1d libpng12-0 librsvg2-2 librsvg2-commonlibsmbclient libsndfile1 libsoup-gnome2.4-1 libsoup2.4-1 libwbclient0libwebkit-1.0-2 libwebkit-1.0-common libxfont1 linux-headers-2.6.32-33linux-headers-2.6.32-33-generic linux-image-2.6.32-33-generic linux-libc-devsamba-common samba-common-bin smbclient xulrunner-1.9.236 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.Need to get 0B/92.7MB of archives.After this operation, 45.1kB of additional disk space will be used.Extracting templates from packages: 100%
Preconfiguring packages …
--output omitted--Processing triggers for libc-bin ...ldconfig deferred processing now taking place0The 0 in the end is the apt-get return, and it means that there were no errors.But if i run the exact same command through puppet it returns "100" which is apt-get's error code
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/efCy34kA-m8J.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
----
I do too but the problem isn't puppet... the problem is what happens from the command line executions of apt-get/aptitude/etc. which obviously leave apt in a state where it requires console interaction to resolve. If you stop using apt from command line, you won't have a problem with the puppet commands. If you use apt on the command line, you should learn to clean up after yourself and run things like 'apt-get -f install' (to install needed dependencies), 'apt-get autoremove' (to clean up unneeded packages), etc.
Also note that the package cache will get stale over time and you would need to run 'apt-get update' prior to running 'apt-get update -y' which is why I told you to note how I used 'require' in my puppet manifests to ensure that happens first.
Craig