Hi Jean,

Is Nginx::Vhost["packages.iscoolapp.com"] getting set up somewhere
else in your code?

If not should your pkgrepo be like this?
class pkgrepo {
         Nginx::Vhost["website.domain.tld"] -> Class['Pkgrepo']
         include pkgrepo::install,pkgrepo::config
}

Or

     pkgrepo::repository { "test":
         docroot     => "/var/www/website.domain.tld",
         gpgkeyid    => "C78033BD",
         require => Nginx::Vhost["website.domain.tld"],
     }

Good luck.

On Oct 29, 12:41 am, Jean Baptiste Favre
<[email protected]> wrote:
> Hello,
> There's something I don't understand with classes dependency.
> I saw many thread about this subject, but still can not figure how it
> works exactly.
>
> I'm trying to setup a debian package repository. For that, I need:
> - a vhost, served by nginx
> - repo managment tools as well as GPG key copied into directory tree
>
> So, that makes 2 classes:
> include nginx
> include pkgrepo
>
> "nginx" class install nginx package and provide a define to deal with
> vhost definition:
>      nginx::vhost { 'website.domain.tld':
>          port     => 80,
>          docroot  => '/var/www',
>          priority => 00,
>      }
> This define will create directory /var/www/website.domain.tld as well as
> deploying vhost file in /etc/nginx/sites-enabled/00-website.domain.tld
>
> "pkgrepo" class will install repo managment tools and deploy repository
> GPG key in /var/www/website.domain.tld/key.gpg
>
> Therefore, it will require vhost to be created before being able to copy
> GPG key.
>
> Here's my setup:
> node nodetest {
>      include nginx
>      nginx::vhost { 'website.domain.tld':
>          port     => 80,
>          docroot  => '/var/www',
>          priority => 00,
>      }
>      include pkgrepo
>      pkgrepo::repository { "test":
>          docroot     => "/var/www/website.domain.tld",
>          gpgkeyid    => "C78033BD",
>      }}
>
> And for classes definition, I got:
> class pkgrepo {
>          Nginx::Vhost["packages.iscoolapp.com"] -> Class['Pkgrepo']
>          include pkgrepo::install,pkgrepo::config
>
> }
>
> Problem is, when I try to executed it twice, I don't alway have
> dependency respected. For sure, I'm doing something wrong, but can not
> figure what. Bellow are the execution output.
>
> Best regards,
> Jean Baptiste Favre
>
> Wrong behaviour:
> # /usr/sbin/puppetd --no-daemonize --logdest console --onetime --verbose
> --preferred_serialization_format marshal
> notice: Ignoring --listen on onetime run
> info: Caching catalog for nodetest
> info: Applying configuration version '1319805719'
> notice: /Stage[main]/Pkgrepo::Install/Package[reprepro]/ensure: ensure
> changed 'purged' to 'present'
> notice:
> /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
> nx/sites-enabled/00-website.domain.tld]/ensure:
> defined content as '{md5}bad3fd5741e335516e2e51aaefe2963c'
> info:
> /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
> nx/sites-enabled/00-website.domain.tld]:
> Scheduling refresh of Service[nginx]
> notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh'
> from 1 events
> notice: Finished catalog run in 6.25 seconds
>
> Good behaviour:
> # /usr/sbin/puppetd --no-daemonize --logdest console --onetime --verbose
> --preferred_serialization_format marshal
> notice: Ignoring --listen on onetime run
> info: Caching catalog for nodetest
> info: Applying configuration version '1319805719'
> notice:
> /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
> nx/sites-enabled/00-website.domain.tld]/ensure:
> defined content as '{md5}bad3fd5741e335516e2e51aaefe2963c'
> info:
> /Stage[main]//Node[nodetest]/Nginx::Vhost[website.domain.tld]/File[/etc/ngi 
> nx/sites-enabled/00-website.domain.tld]:
> Scheduling refresh of Service[nginx]
> notice: /Stage[main]/Pkgrepo::Install/Package[reprepro]/ensure: ensure
> changed 'purged' to 'present'
> notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh'
> from 1 events
> notice: Finished catalog run in 6.23 seconds

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to