Ask Your Question
0

`/usr/bin/env: ruby: No such file or directory` in `tomcat::setenv::entry`

asked 2015-11-30 01:29:22 -0500

Yasser Zamani gravatar image

updated 2015-11-30 12:24:51 -0500

I have following puppet code in a manifest:

    tomcat::setenv::entry {'JAVA_OPTS':
  value => "-Xms128m -Xmx12048m -XX:MaxPermSize=2024m",
}

but running

sudo puppet agent --test

at puppet agent, causes following error:

Error: /Stage[main]/Main/Node[software]/Tomcat::Setenv::Entry[JAVAOPTS] /Concat[/usr/share/tomcat7029/bin/setenv.sh]/ Exec[concat/usr/share/tomcat7029/bin/setenv.sh]: Could not evaluate: /usr/bin/env: ruby: No such file or directory

At puppet agent I've installed ruby from source, not rvm, and following command says me:

software:~/ # /usr/bin/env ruby --version
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
software:~/ # pwd
/root/
software:~/ #

At puppet master, Ruby has been installed with puppetserver package, and above command says same things.

How to figure this out, please?

[Edit 1]

After running:

sudo puppet agent --test --debug

these are interesting output which may help:

Debug: Exec concat/usr/share/tomcat7029/bin/setenv.sh: Executing check '/opt/puppetlabs/puppet/cache/concat/bin/concatfragments.rb -o "/opt/puppetlabs/puppet/cache/concat/usrsharetomcat7029binsetenv.sh/fragments.concat.out" -d "/opt/puppetlabs/puppet/cache/concat/usrsharetomcat7029binsetenv.sh" -l -t'

Debug: Executing: '/opt/puppetlabs/puppet/cache/concat/bin/concatfragments.rb -o "/opt/puppetlabs/puppet/cache/concat/usrsharetomcat7029binsetenv.sh/fragments.concat.out" -d "/opt/puppetlabs/puppet/cache/concat/usrsharetomcat7029binsetenv.sh" -l -t'

[mNotice: /Stage[main]/Main/Node[software]/Tomcat::Setenv::Entry[JAVAOPTS]/Concat[/usr/share/tomcat7029/bin/setenv.sh]/File[/usr/share/tomcat7029/bin/setenv.sh]: Dependency Exec[concat/usr/share/tomcat70_29/bin/setenv.sh] has failures: true

File fragments.concat.out and directory _usr_share_tomcat_7_0_29_bin_setenv.sh both exist and that directory has a sub-directory named fragments which contains a file named 10_setenv-JAVA_OPTS. All things appear OK! but I also tried the above execute command (/opt/puppetlabs/puppet/cache/concat/bin/concatfragments.rb ...) in command line manually and same output appeared, /usr/bin/env: ruby: No such file or directory.

edit retag flag offensive close merge delete

Comments

Are you able to run the setenv.sh script successfully by hand on the Puppet agent machine? Is the ruby package installed on the Puppet agent machine prior to the invocation of the setenv.sh script by Puppet?

GregLarkin gravatar imageGregLarkin ( 2015-11-30 11:21:27 -0500 )edit

@GregLarkin,On Puppet agent machine, still there is no any `setenv.sh` file because tomcat does not have this file in it's bin folder by default and I expect Puppet to create one.and yes,the ruby package is installed.I installed it by compiling from source before puppet installation which was needed

Yasser Zamani gravatar imageYasser Zamani ( 2015-11-30 12:33:01 -0500 )edit

@GregLarkin, I updated the question with output of debug messages. It seems that it does not have any problem with ruby installation itself, but `concatfragments.rb` expect some file or directory which does not exist.

Yasser Zamani gravatar imageYasser Zamani ( 2015-11-30 12:41:49 -0500 )edit

@GregLarkin, I resolved it as below. Thank you for your attention and sorry for inconvenience.

Yasser Zamani gravatar imageYasser Zamani ( 2015-12-01 11:29:21 -0500 )edit

Hey, no problem and glad you figured it out!

GregLarkin gravatar imageGregLarkin ( 2015-12-01 16:04:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-12-01 11:25:13 -0500

Yasser Zamani gravatar image

I'm genius! The problem was with sudo which resets $PATH environment variable to minimum and so, does not know ruby any more. To avoid this, I edited /etc/sudoers with following command:

sduo visudo

or

sudo vi /etc/sudoers

then edited following line as:

Defaults env_keep += "PATH ...

Actually I added PATH to env_keep which means sudo should keep this variable unchanged ;)

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

1 follower

Stats

Asked: 2015-11-30 01:29:22 -0500

Seen: 743 times

Last updated: Dec 01 '15