puppet module list fails

asked 2017-11-03 11:22:39 -0600

When 'puppet module list' fails, how to handle the error by ignoring it?

Query:

  generate("/bin/bash","-c",'for env in $(ls -1 /etc/puppetlabs/code/environments); do /opt/puppetlabs/bin/puppet module list --environment $env --modulepath /etc/puppetlabs/code/environments/$env/modules; done')
edit retag flag offensive close merge delete

Comments

You're in a shell, aren't you: puppet module list --environment ${env} … || continue

Kai Burghardt gravatar imageKai Burghardt ( 2017-11-03 12:43:49 -0600 )edit

Yes. I am in a shell.

Redsmile gravatar imageRedsmile ( 2017-11-03 12:49:53 -0600 )edit

It was a rhetorical question. My suggestion was to `|| continue` (“or continue”).

Kai Burghardt gravatar imageKai Burghardt ( 2017-11-03 15:56:38 -0600 )edit