Ask Your Question
0

unable to run ./install in exec resource

asked 2015-04-29 10:22:49 -0500

Chutki gravatar image

Hi,

I wrote following manifests, but getting same error for both the options

option 1:

 exec {"test_install":
        cwd     => '/opt/hu/sd/instal/downlaod',
        command => "./install.sh -i",
        unless  => "/bin/rpm -q test_package"
      }

option 2:

exec {"./install.sh -i":
    cwd     => '/opt/hu/sd/instal/downlaod',
    alias   => "test_install",
    unless  => "/bin/rpm -q test_package"
  }

getting below error

failed: './install.sh -i' is not qualified and no path was specified. Please qualify the command or specify a path. at /etc/puppetlabs/modules/test/manifests/install_test_mani.pp:5
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-04-29 13:28:20 -0500

JohnsonEarls gravatar image

Exec does not allow you to run executables relative to the cwd parameter. You either need to provide a fully-qualified command (beginning with /), or you need to provide the path parameter with an array or string of fully-qualified directories in which to find the command. Note: the path parameter to exec will replace the system PATH variable; you need to include standard system directories in your path array also.

Example:

exec { "test_install":
    cwd     => '/opt/hu/sd/instal/download' ,
    path    => [ '/opt/hu/sd/instal/download' ,'/bin', '/usr/bin' ],
    command => "install.sh -i",
    unless  => "/bin/rpm -q test_package"
  }
edit flag offensive delete link more

Comments

Thanks it worked.

Chutki gravatar imageChutki ( 2015-04-29 17:16:54 -0500 )edit

I have doubt in your answer, you mentioned "the path parameter to exec will replace the system PATH variable", what you mean by system PATH here

Chutki gravatar imageChutki ( 2015-05-04 04:09:54 -0500 )edit

@Chutki - The system PATH is the environment variable that the system uses to find executables. If you run a shell script (...`.sh`) from an `exec` with `path => [ '/foo' ]` then, for that shell script, the system will _only_ look at `/foo` to find commands to run.

JohnsonEarls gravatar imageJohnsonEarls ( 2015-05-04 14:45:40 -0500 )edit

Thanks for your explanation.

Chutki gravatar imageChutki ( 2015-05-04 23:25:49 -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: 2015-04-29 10:22:49 -0500

Seen: 433 times

Last updated: Apr 29 '15