StorminStanley / st2workroom

Vagrant environment used to play with StackStorm, develop StackStorm for your environment, or develop on StackStorm itself!
Apache License 2.0
23 stars 21 forks source link

Bootstrap debug logging #317

Closed jfryman closed 8 years ago

jfryman commented 8 years ago

This PR adds some helpers that allows executed commands to properly make it to a log file or STDOUT/STDERR based on setting the DEBUG ENV variable.

/cc @Kami

Kami commented 8 years ago

Nice, this should save us some time when troubleshooting user problems. :+1:

I will test it tomorrow.

lakshmi-kannan commented 8 years ago

:+1:

Kami commented 8 years ago

@lakshmi-kannan or if you want / have time, you can test it as well :P

Kami commented 8 years ago

Pushed a change since - is apparently not a valid character for a function name in sh.

I did actually suggest we should just default to bash, but other people thought defaulting to sh is better :P

Kami commented 8 years ago

I also updated "script/preflight-os" to also use this new function since this was actually the main offending part which logged to a file instead of stdout / stderr.

jfryman commented 8 years ago

I did actually suggest we should just default to bash, but other people thought defaulting to sh is better :P

😐

Kami commented 8 years ago

In confirmed it now works with the latest changes:

Ensuring pre-flight libraries are setup...
Running bundle install --path vendor/bundle --deployment --binstubs...
Installing rake (10.3.2) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/rake-10.3.2.gemspec 
Installing CFPropertyList (2.2.8) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/CFPropertyList-2.2.8.gemspec 
Installing i18n (0.7.0) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/i18n-0.7.0.gemspec 
Installing json (1.8.3) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/json-1.8.3.gemspec 
Installing minitest (5.8.0) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/minitest-5.8.0.gemspec 
Installing thread_safe (0.3.5) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/thread_safe-0.3.5.gemspec 
Installing tzinfo (1.2.2) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/tzinfo-1.2.2.gemspec 
Installing activesupport (4.2.3) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/activesupport-4.2.3.gemspec 
Installing builder (3.2.2) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/builder-3.2.2.gemspec 
Installing activemodel (4.2.3) from /opt/puppet/vendor/bundle/ruby/1.9.1/specifications/activemodel-4.2.3.gemspec 
...

I will test it some more and if everything looks OK merge it into master.

Kami commented 8 years ago

Tested it on multiple servers with and without DEBUG environment variable. It appears to be working OK so I will go ahead and merge it.