We currently use Debian's unattended-upgrades which will cause an apt-get 
update to be run at the same time (around 0500ish), however in this 
instance I made some changes to a manifest to pull in a new sources.list 
and then install packages from it - this the kind of scenario I'm 
attempting to find a way around.

On Monday, June 6, 2016 at 4:33:02 PM UTC+1, Matt Zagrabelny wrote:
>
> On Mon, Jun 6, 2016 at 9:46 AM, Simon Weald <[email protected] 
> <javascript:>> wrote: 
> > Hi everyone 
> > 
> > I've got a little bit of an issue which I'm currently fighting with. At 
> the 
> > moment, we pass an array of packages to be installed to the package 
> > resource, however I need to call an apt-get update prior to the package 
> > installation (in case we add a new repo etc). My snippet below should 
> > probably give you a good idea of what I want to achieve: 
> > 
> > $installpackages = hiera_array('installed-packages') 
> > 
> > exec { "apt-update": 
> >  command => "/usr/bin/apt-get update", 
> >  refreshonly => true, 
> > } 
> > 
> > package { $installpackages: 
> >  ensure => 'present', 
> >  require => Exec['apt-update'], 
> > } 
> > 
> > Obviously my goal is to have the update only run if any packages are 
> > actually going to be installed - I can't use empty() against the array 
> as it 
> > will always contain content. 
> > 
> > Can anyone suggest how I can achieve this? 
>
> We're using the puppetlabs apt resource and a line like: 
>
> Apt::Source <| |> -> Package <| |> 
>
> to ensure that any Apt::Source is processed before any package 
> installation. 
>
> I know this doesn't quite do the updating - we do that daily via cron, 
> but it does demonstrate the global dependency ordering of sources and 
> packages. 
>
> Hope that helps! 
>
> -m 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/26723230-294c-4ada-95c5-b9f31e86f5d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to