how to install a module from github

2,315 views
Skip to first unread message

Kevin G.

unread,
Oct 29, 2012, 7:03:30 PM10/29/12
to puppet...@googlegroups.com
I seem to be missing something.  I've copied the files from this module https://github.com/torrancew/puppet-cron into my modulepath

$ puppet master --configprint modulepath 
/etc/puppet/modules:/usr/share/puppet/modules

so it looks like this:

/etc/puppet/modules/cron-job/
/etc/puppet/modules/cron-job/manifests/
/etc/puppet/modules/cron-job/manifests/daily.pp
/etc/puppet/modules/cron-job/manifests/hourly.pp
/etc/puppet/modules/cron-job/manifests/init.pp
/etc/puppet/modules/cron-job/manifests/install.pp
/etc/puppet/modules/cron-job/manifests/job.pp
/etc/puppet/modules/cron-job/manifests/monthly.pp
/etc/puppet/modules/cron-job/manifests/weekly.pp
/etc/puppet/modules/cron-job/templates/
/etc/puppet/modules/cron-job/templates/job.erb

AFAICT from the docs I should be able to do just this in my own manifests

include daily
 
but all I get is

Could not find class daily

What am I doing wrong?

Jenner La Fave

unread,
Oct 29, 2012, 7:19:11 PM10/29/12
to puppet...@googlegroups.com
cron::daily is actually a defined resource type, so you need to declare that resource as opposed to including a class. If you have multiple nodes that you would like to include the same cron job on, you can write your own class that declares a cron resources and include that.

It's hard to say without knowing what you're trying to do, but something like this might be a good place to start:

class crontest {
    cron::daily {"test_cron_job":
        minute  => '0,15,30,45',
        hour    => '0,12',
        command => '/usr/bin/derp --foo';

Kevin G.

unread,
Oct 29, 2012, 7:31:53 PM10/29/12
to puppet...@googlegroups.com
On Monday, October 29, 2012 4:19:11 PM UTC-7, Jenner La Fave wrote:
cron::daily is actually a defined resource type, so you need to declare that resource as opposed to including a class. If you have multiple nodes that you would like to include the same cron job on, you can write your own class that declares a cron resources and include that.

It's hard to say without knowing what you're trying to do, but something like this might be a good place to start:

class crontest {
    cron::daily {"test_cron_job":
        minute  => '0,15,30,45',
        hour    => '0,12',
        command => '/usr/bin/derp --foo';
    }
}

 That's what I thought at first, but doing that I get:

Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type cron::daily

so I figured I needed to include the file first. 

Am I still missing something?

Jenner La Fave

unread,
Oct 29, 2012, 7:38:07 PM10/29/12
to puppet...@googlegroups.com
Oh, right. You need to rename /etc/puppet/modules/cron-job/ to cron/

The outermost directory needs to match the module name which needs to be "cron".

Kevin G.

unread,
Oct 29, 2012, 8:19:41 PM10/29/12
to puppet...@googlegroups.com
On Monday, October 29, 2012 4:38:07 PM UTC-7, Jenner La Fave wrote:
Oh, right. You need to rename /etc/puppet/modules/cron-job/ to cron/

The outermost directory needs to match the module name which needs to be "cron".

Aha! That's it, thank you! 


So I went back and peered at that page again and even in retrospect, knowing the answer, it was hard to see on there, but there it is, "This outermost directory’s name matches the name of the module."  I don't know how that could be any clearer, but it's still hard to see.  Well, I gave torrancew on github a pull request to add a hint to his README.mk, maybe that'll help the next guy with my problem.

Thanks so much!



 
Reply all
Reply to author
Forward
0 new messages