Ask Your Question
0

how to make one resource run after the previous one is executed?

asked 2016-06-21 16:22:43 -0500

puppetamateur gravatar image

I have a class that unzips a file first and then looks for a file in the extracted folder to replace it. however, when I run it. it executes the find file before unzipping the file and hence produces error. how can i solve it? how can i make one resource to run after another?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-06-21 17:42:43 -0500

UBPClaw gravatar image

Use the before metaparameter

class foo {

    unzip { '/tmp/file.zip' :
       ensure => present,
       before => File[ "/tmp/resulting_file.txt" ]

    file { '/tmp/resulting_file.txt':
       ensure => present,
    }
}
edit flag offensive delete link more

Comments

it gives me the error:[ "/tmp/resulting_file.txt" ] cannot be converted to Numeric.

puppetamateur gravatar imagepuppetamateur ( 2016-06-21 18:30:45 -0500 )edit

That was just crap pseudocode I made up. Insert the before statement in to your code using the name of the file resource you created. Or give an example of your code

UBPClaw gravatar imageUBPClaw ( 2016-06-21 18:41:59 -0500 )edit

Ya. I replaced the filename with mine. it gave me that error. withmy filename

puppetamateur gravatar imagepuppetamateur ( 2016-06-21 18:58:03 -0500 )edit

Did you put quotes around your file name in the before parameter?

DarylW gravatar imageDarylW ( 2016-06-21 23:47:42 -0500 )edit

What is output of puppet parser validate command?

UBPClaw gravatar imageUBPClaw ( 2016-06-22 10:08:00 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-21 16:22:43 -0500

Seen: 28 times

Last updated: Jun 21 '16