Ask Your Question
1

How to handle dependancy?

asked 2013-05-14 14:39:53 -0600

Matt F. gravatar image

updated 2013-05-14 15:09:15 -0600

ramindk gravatar image

I have two modules, and I'm having some dependacy problems:

1 - Install python "pip":

class pythonpip::install {
    file {"/root/.pip":
        ensure => directory,
        owner  => root,
        group  => root,
        mode   => 755
    }
    file {"/root/.pip/pip.conf":
        ensure  => present,
        source => 'puppet:///modules/pythonlinux/pip.conf',
        mode    => 0644,
    }
}

2 - install some python packages via "pip":

class myapp::install {
    package {
        "mechanize":
            provider => pip;
        "numpy":
            provider => pip;
        "pandas":
            provider => pip;
        "reportlab":
            provider => pip;
    }
}

I want to make sure tha the "pythonpip::install" is alway run before the "myapp::install". How can I do that? I'm running puppet 3.1.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-05-14 15:08:27 -0600

ramindk gravatar image

I'd would handle it with resource collections. The same method works for gem or any other provider that may need packages installed before you can use it.

class pythonpip::install {
  file {'/root/.pip':
    ensure => directory,
    owner  => root,
    group  => root,
    mode   => '0755,
  }

  file {'/root/.pip/pip.conf':
    ensure => present,
    source => 'puppet:///modules/pythonlinux/pip.conf',
    mode   => '0644',
  }

  Class['pythonpip::install'] -> Package <| provider == pip |>
}

You can read more about about Resource Collections here.

edit flag offensive delete link more

Comments

Thanks, that worked perfectly.

Matt F. gravatar imageMatt F. ( 2013-05-14 15:37:55 -0600 )edit

I do the same thing. Matt, would you kindly mark this answer as correct?

Ancillas gravatar imageAncillas ( 2013-05-21 11:58:22 -0600 )edit
0

answered 2013-05-21 07:43:00 -0600

class myapp::install {
    require pythonpip::install
    package {
        "mechanize":
            provider => pip;
        "numpy":
            provider => pip;
        "pandas":
            provider => pip;
        "reportlab":
            provider => pip;
    }
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-14 14:39:53 -0600

Seen: 501 times

Last updated: May 21 '13