Ask Your Question

How to install .run custom made program which needs to be executed in order to install a program

asked 2015-11-30 10:07:39 -0600

nick_baba gravatar image

I am trying to install this software but I want to know if its possible to execute the command and Enter the following details during installation:

43 times “Enter” to read the license agreement Enter “Y” to agree with the license Enter “user name” Enter “Password” Enter “Confirm” Enter “y” to start installation of the software

file {'/usr/local/': ensure => present, owner => root, group => root, source => 'puppet:///modules/wowzaorigin4.3.0/', }

exec { '/usr/local/': path => ['/usr/bin', '/usr/sbin', '/bin'], cwd => '/usr/local/',

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-11-30 11:18:09 -0600

GregLarkin gravatar image

Puppet can only exec non-interactive applications. There's no way to prompt for any user input during a Puppet run.

That being said, there are various ways in UNIX to work around limitations, unless you are dealing with a GUI installer. Your first task will be to come up with a way to perform a non-interactive installation from the command line. Sometimes, that can be as easy as using this technique:

Or if the installer is particularly ornery, you have may to resort to the expect command:

There are 1000s of examples for using the expect command if you search in Google, but I hope the link above will give you some idea of how it works.

Once you have created the perfect UNIX command pipeline to install the software, then you can wrap it in an exec resource to be installed non-interactively by Puppet.

edit flag offensive delete link more

answered 2015-12-30 08:19:43 -0600

Did you ever find any additional prompts or an answer to this solution? I have been trying to figure out this exact issue for over a month. We have software that needs to be installed on each server and the software gives prompts that need to be answered in order to complete. Expect works perfect but puppet doesn't seem to like to execute it. For me, the module seems to complete successfully but when I got to verify if the expect script was actually executed I can see it never ran because the software isn't present. Expect script works fine when running it cli on the server itself.

edit flag offensive delete link more


Try running the agent with the "--debug" option, too. That should show you the actual command it runs when it invokes expect. It's possible that Puppet executes the command with a minimal environment, and maybe that causes a problem vs. running at a full login command prompt.

GregLarkin gravatar imageGregLarkin ( 2015-12-30 18:27:55 -0600 )edit

I have the expect command being called from a script and the script is being called by puppet. The expect command isn't seen in the debug unfortunately. The debug says the script has run successfully. There are 4 commands in this script and the last one is the expect command which doesn't get run

Odysseaus gravatar imageOdysseaus ( 2015-12-31 08:01:07 -0600 )edit

What I would do in that case is add a bunch of log redirects to the commands inside your script. You might even go so far as to invoke the expect command with strace and the options "-ff -v -s 256 -o /tmp/expect.log" so you can see why the process fails or doesn't start correctly.

GregLarkin gravatar imageGregLarkin ( 2015-12-31 12:13:43 -0600 )edit

You should have a bunch of files named "/tmp/expect.log.XXXXX" after strace exits, and check them for possible system call errors that indicate why the process didn't execute. "XXXXX" will correspond to different process pids spawned by the parent expect process.

GregLarkin gravatar imageGregLarkin ( 2015-12-31 12:14:31 -0600 )edit

answered 2015-12-07 11:02:00 -0600

nick_baba gravatar image

updated 2015-12-08 00:39:56 -0600

GregLarkin gravatar image

Thank u for pointing me to the right direction, I managed to create the script with the Autoexpect command and it works fine when I run it on the server (takes 15 sec for installation to complete) but when I deploy it via puppet, it takes ages to install and then it times out, so I added === timeout => 1000, === it did not help, still the same issue, any idea how to resolve the timeout issue?

Error: /Stage[main]/Wowza_origin_4_3_0/Exec[script.exp]: Failed to call refresh: Command exceeded timeout
Error: /Stage[main]/Wowza_origin_4_3_0/Exec[script.exp]: Command exceeded timeout

  file {'/usr/local/script.exp':
      ensure => present,
      source => 'puppet:///modules/ubuntu_basenode/wowza_origin_4.3.0/script.exp',
      notify => Exec['script.exp'],
  exec { 'script.exp':
     path    => ["/usr/local"],
     cwd  => '/usr/local/',
     command => "/usr/local/script.exp",
     refreshonly => true,
     timeout     => 1000,
edit flag offensive delete link more


It's possible you are seeing effects of different environment variables in this situation. If the expect command works fine during an interactive shell, it may be due to additional environment variables that are present. See if the command also works in a clean shell environment.

GregLarkin gravatar imageGregLarkin ( 2015-12-08 00:41:33 -0600 )edit

Also try running your puppet agent or puppet apply command with the "--debug" flag, and that may show some issues that will help troubleshoot the problem. It's likely that the installer has presented some additional prompt that the expect process is not handling, hence the installer hangs.

GregLarkin gravatar imageGregLarkin ( 2015-12-08 00:43:29 -0600 )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


Asked: 2015-11-30 10:07:39 -0600

Seen: 456 times

Last updated: Dec 08 '15