how to force a zypper refresh?

601 views
Skip to first unread message

randal cobb

unread,
Aug 25, 2014, 10:35:53 AM8/25/14
to puppet...@googlegroups.com
Hello all,

I'm trying to solve an issue with Puppet and I'm hoping you can help guide me.  We have an internal YUM repository that we build/deploy to quite frequently, and several of the artifacts we publish to that repository need to be pushed out (via puppet) to servers a couple of times per day.   All of my servers are SLES or openSuse based, and thus use Zypper.  My question is, since the repository gets updated frequently and zypper doesn't refresh repository indexes by itself, is there a way to force a zypper refresh ALWAYS as the first task in a manifest?

I've tried adding an exec item in a sample machine's manifest and having all the "packages" require it, but it isn't doing what I expect.  It never seems to run the "refresh" prior to trying to install any packages.  Here are a few snippets from my manifest structure:

in base.pp:
    exec { zypper-refresh:
        command
=> 'zypper --no-gpg-checks refresh',
        path
=> ["/usr/bin", "/bin", "/sbin"],
   
}


   
package { "puppet":
       
ensure => installed,
       
require => Exec['zypper-refresh'],
   
}


   
package { "augeas":
       
ensure => present,
       
require => Package['puppet'],
   
}


   
package { "rubygem-ruby-augeas":
       
ensure => present,
       
require => Package['augeas'],
   
}


in test-server.pp (which inherits base.pp)
    package { 'geany':
        ensure => installed,
        require => Exec['zypper-refresh'],
    }

    package { 'myjavamodule_xx':
        ensure => installed,
        require => Exec['zypper-refresh'],
    }


etc.

Any suggestions? 

Darin Perusich

unread,
Aug 25, 2014, 11:37:26 AM8/25/14
to puppet...@googlegroups.com
Use the zypprepo module to managing your zypper repositories.

https://forge.puppetlabs.com/darin/zypprepo

puppet module install darin-zypprepo
--
Later,
Darin
> --
> 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 puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/a98d4d09-c0a0-480e-8904-adf075179a8e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

randal cobb

unread,
Aug 25, 2014, 12:13:03 PM8/25/14
to puppet...@googlegroups.com
Thanks for the very quick reply!  I'll give that a shot.
Reply all
Reply to author
Forward
0 new messages