Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify configuration file path #253

Closed
vg-github opened this issue Oct 19, 2016 · 13 comments
Closed

specify configuration file path #253

vg-github opened this issue Oct 19, 2016 · 13 comments

Comments

@vg-github
Copy link

vg-github commented Oct 19, 2016

At the moment tugboat looks for its config file in ~/.tugboat.

Any chance we can specify the config file path in each call, or at least have it as an alternative specificed as an env var?

If the .tugboat is not found, I get something like this as well:

/usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': can't modify frozen String (RuntimeError)
from /usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/extensions/ruby_version_check.rb:10:in `new'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/extensions/ruby_version_check.rb:10:in `with_minimum_ruby'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:8:in `<class:Array>'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:5:in `<module:Hashie>'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:4:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/mash.rb:2:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge/response.rb:4:in `<module:Barge>'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge/response.rb:3:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge.rb:5:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware/inject_client.rb:1:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:121:in `block in sequence_info_droplet'
from /var/lib/gems/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in `instance_eval'
from /var/lib/gems/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in `initialize'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:118:in `new'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:118:in `sequence_info_droplet'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/cli.rb:353:in `info'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/bin/tugboat:10:in `<top (required)>'
from /usr/local/bin/tugboat:23:in `load'
from /usr/local/bin/tugboat:23:in `<main>'

Would be great if it just returned an error code.

@petems
Copy link
Owner

petems commented Oct 19, 2016

What command are you running and getting that error? Normally Tugboat catches the file missing

You can specify the environment variable TUGBOAT_CONFIG_PATH to specify a specific location for a tugboat config file.

It will also look for a .tugboat file in the current directory.

I'll open a PR to add this to the docs 👍

@vg-github
Copy link
Author

vg-github commented Oct 19, 2016

Many thanks, it seems it actually picks up the config file, but ruby still throws this error:

/usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': can't modify frozen String (RuntimeError)
from /usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/extensions/ruby_version_check.rb:10:in `new'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/extensions/ruby_version_check.rb:10:in `with_minimum_ruby'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:8:in `<class:Array>'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:5:in `<module:Hashie>'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:4:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/mash.rb:2:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge/response.rb:4:in `<module:Barge>'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge/response.rb:3:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge.rb:5:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware/inject_client.rb:1:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:56:in `block in sequence_verify'
from /var/lib/gems/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in `instance_eval'
from /var/lib/gems/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in `initialize'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:53:in `new'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:53:in `sequence_verify'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/cli.rb:66:in `verify'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/bin/tugboat:10:in `<top (required)>'
from /usr/local/bin/tugboat:23:in `load'
from /usr/local/bin/tugboat:23:in `<main>'

Is there a bug in parsing the config file?

@petems
Copy link
Owner

petems commented Oct 19, 2016

Hmm, possibly. Can you post your config file here, redacted API key if needed?

@vg-github
Copy link
Author

vg-github commented Oct 19, 2016

tugboat config

Path: /root/.tugboat
---
authentication:
  access_token:  [REDACTED]
ssh:
  ssh_user: root
  ssh_key_path: [REDACTED]
  ssh_port: '22'
defaults:
  region: lon1
  image: ubuntu-14-04-x64
  size: 512mb
  ssh_key: ''
  private_networking: 'true'
  backups_enabled: 'false'
  ip6: 'false'

@petems
Copy link
Owner

petems commented Oct 19, 2016

@vladimirghetau Can you also post the raw yaml into this ticket?

Also, what command are you running to get the error?

@vg-github
Copy link
Author

vg-github commented Oct 19, 2016

@petems many thanks, I am running latest tugboat version, ubuntu 14.04, ruby 2.3.1, and this error comes with any command ( in this instance it's tugboat images ).

I can prevent the error by sending the command from the exact folder where the config file is located, but the only way to replicate this error is using Jenkins or by navigating in a different folder than the one where .tugboat resides.

Raw Yaml:

---
authentication:
  access_token: [REDACTED]
ssh:
  ssh_user: root
  ssh_key_path: "[REDACTED]"
  ssh_port: '22'
defaults:
  region: lon1
  image: ubuntu-14-04-x64
  size: 512mb
  ssh_key: ''
  private_networking: 'true'
  backups_enabled: 'false'
  ip6: 'false'

Again, this config works, but only when I run tugboat from the same path where it resides.

@petems
Copy link
Owner

petems commented Oct 19, 2016

Ah, yeah it could be a Ruby 2.3.1 issue, I remember there being a frozen string issue with 2.3.1

https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3

Let me see if I can test that

@petems
Copy link
Owner

petems commented Oct 19, 2016

@vladimirghetau Can you run with DEBUG=1 for me?

@vg-github
Copy link
Author

I actually did, it seems the ruby component fails before the DEBUG=1 is even considered.

My assumption is it fails to process the content of the file due to some character that it doesn't understand while using a string function native to ruby.

A way to replicate this would be:

  • get a clean vm, install ruby and then gem install tugboat
  • run tugboat authorize, the error will show up, see below

The output to what you asked was:

root@ubuntu-512mb-nyc3-01:# DEBUG=1
root@ubuntu-512mb-nyc3-01:
# tugboat authorize
/usr/lib/ruby/1.9.1/rubygems/version.rb:191:in strip!': can't modify frozen String (RuntimeError) from /usr/lib/ruby/1.9.1/rubygems/version.rb:191:ininitialize'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/extensions/ruby_version_check.rb:10:in new' from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/extensions/ruby_version_check.rb:10:inwith_minimum_ruby'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:8:in <class:Array>' from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:5:inmodule:Hashie'
from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/array.rb:4:in <top (required)>' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /var/lib/gems/1.9.1/gems/hashie-3.4.6/lib/hashie/mash.rb:2:in<top (required)>'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge/response.rb:4:in <module:Barge>' from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge/response.rb:3:in<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /var/lib/gems/1.9.1/gems/barge-0.12.0/lib/barge.rb:5:in <top (required)>' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware/inject_client.rb:1:in<top (required)>'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:56:in block in sequence_verify' from /var/lib/gems/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:38:ininstance_eval'
from /var/lib/gems/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in initialize' from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:53:innew'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/middleware.rb:53:in sequence_verify' from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/lib/tugboat/cli.rb:66:inverify'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:ininvoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in dispatch' from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:instart'
from /var/lib/gems/1.9.1/gems/tugboat-2.2.2/bin/tugboat:10:in <top (required)>' from /usr/local/bin/tugboat:23:inload'
from /usr/local/bin/tugboat:23:in `

'

I can provide access to an isolated VM for investigation if needed.

@petems
Copy link
Owner

petems commented Oct 19, 2016

An isolated VM would be awesome, I can't replicate on my machine with OSX Ruby 2.3.1

@vg-github
Copy link
Author

thanks @petems - trying to find an email or any way of contacting you privately and cannot. Any chance you can email me a DM on twitter (just followed you).

@petems
Copy link
Owner

petems commented Oct 20, 2016

@vladimirghetau Cool, followed back! 👍

@petems
Copy link
Owner

petems commented Oct 26, 2016

Thanks for the machine, it looks like a non related issue to Tugboat, it turns out the problem was an old version of Rubygems (See rubygems/bundler#3187)

$ gem install rubygems-update
$ update_rubygems
$ gem update --system
$ gem install tugboat
$ tugboat authorize
Note: You can get your Access Token from https://cloud.digitalocean.com/settings/tokens/new

Enter your access token:

@petems petems closed this as completed Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants