How to use "defined" type as requirement inside exec

22 views
Skip to first unread message

Malintha Adikari

unread,
Jun 26, 2014, 1:49:55 AM6/26/14
to puppet...@googlegroups.com
Hi,

I have defined type as follows

define fill_templates($location) {
    $fileName = $name["filename"]                                                      
    $fileLocation = $name["filelocation"]  
    file { "${fileLocation}/${fileName}/":
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0777',
        content => template("config/${fileName}.erb"),
    require => Exec["unzip_pack"],
}

}


And I call that type as

fill_templates { $foo: location=>$agentLocation}

I want to make this a pre-requirement to my another exec. So I want to make it "require" for that exec.

exec { "strating":
    user       => 'root',
    environment => 'JAVA_HOME=/home/agent2/jdk1.6.0',
    path        => $command_path,
    command    => "${agents_location}/...../bin/myFiler.sh",
   logoutput => true,
timeout => 3600,
require =>XXXXXXXXXXX,
  }

How Can I do that ?

Regards,
Malintha Adikari

Gavin Williams

unread,
Jun 26, 2014, 3:54:51 AM6/26/14
to puppet...@googlegroups.com
Something like:

require => Fille_template[$foo]

should do it...

Gav

Felix Frank

unread,
Jun 26, 2014, 4:55:59 AM6/26/14
to puppet...@googlegroups.com
On 06/26/2014 07:49 AM, Malintha Adikari wrote:
> $fileName = $name["filename"]
> $fileLocation = $name["filelocation"]

I hope you're aware that his is nonsensical - the $name variable *never*
takes a hash value. It is always the resource title, a string.

Malintha Adikari

unread,
Jun 26, 2014, 5:10:00 AM6/26/14
to puppet...@googlegroups.com
It works, Thank you
Reply all
Reply to author
Forward
0 new messages