sparkleformation / sparkle_formation

Ruby orchestration templating library built with unicorns and rainbows
http://www.sparkleformation.io
Apache License 2.0
222 stars 47 forks source link

NoMethodError - undefined method `lock' for nil:NilClass w/ bogo v0.2.15 #273

Closed universam1 closed 2 years ago

universam1 commented 2 years ago

@chrisroberts https://github.com/spox/bogo/releases/tag/v0.2.15 breaks sparkleformation run:

se `bundle info [gemname]` to see where a bundled gem is installed.
Attempting to run deploy
[ERROR]: Failed to create remote API connection. Please validate configuration!
[ERROR]: Connection failure reason - Miasma::Error - Failed to load requested API type :Orchestration (Reason: NoMethodError - undefined method `lock' for nil:NilClass)
[ERROR]: Failed to load requested API type :Orchestration (Reason: NoMethodError - undefined method `lock' for nil:NilClass)
dhohengassner commented 2 years ago

@universam1 @chrisroberts this is the debug log I got with sfn cli print attempt:

/tmp/tmp.mPjInE # bundle exec sfn print -u -r -f sparkleformation/template.rb  -w output.json
undefined method `lock' for nil:NilClass
Ignore this error if you do not use a SFN_STACKFILE...
ERROR: undefined method `lock' for nil:NilClass
DEBUG: Stacktrace: NoMethodError: undefined method `lock' for nil:NilClass
/usr/local/lib/ruby/2.6.0/monitor.rb:192:in `mon_enter'
/usr/local/lib/ruby/2.6.0/monitor.rb:233:in `block in mon_synchronize'
/usr/local/lib/ruby/2.6.0/monitor.rb:233:in `handle_interrupt'
/usr/local/lib/ruby/2.6.0/monitor.rb:233:in `mon_synchronize'
/usr/local/bundle/gems/bogo-0.2.15/lib/bogo/lazy.rb:26:in `data'
/usr/local/bundle/gems/bogo-config-0.2.2/lib/bogo-config/config.rb:143:in `init!'
/usr/local/bundle/gems/bogo-config-0.2.2/lib/bogo-config/config.rb:114:in `initialize'
/usr/local/bundle/gems/bogo-cli-0.2.18/lib/bogo-cli/command.rb:105:in `new'
/usr/local/bundle/gems/bogo-cli-0.2.18/lib/bogo-cli/command.rb:105:in `load_config!'
/usr/local/bundle/gems/bogo-cli-0.2.18/lib/bogo-cli/command.rb:44:in `initialize'
/usr/local/bundle/gems/sfn-3.1.8/lib/sfn/command.rb:50:in `initialize'
/usr/local/bundle/gems/sfn-3.1.8/bin/sfn:50:in `new'
/usr/local/bundle/gems/sfn-3.1.8/bin/sfn:50:in `block (4 levels) in <top (required)>'
/usr/local/bundle/gems/bogo-cli-0.2.18/lib/bogo-cli/setup.rb:26:in `block in bogo_cli_run'
/usr/local/bundle/gems/slop-3.6.0/lib/slop.rb:260:in `parse!'
/usr/local/bundle/gems/slop-3.6.0/lib/slop.rb:235:in `parse!'
/usr/local/bundle/gems/slop-3.6.0/lib/slop.rb:65:in `parse!'
/usr/local/bundle/gems/slop-3.6.0/lib/slop.rb:54:in `parse'
/usr/local/bundle/gems/bogo-cli-0.2.18/lib/bogo-cli/setup.rb:50:in `define'
/usr/local/bundle/gems/sfn-3.1.8/bin/sfn:14:in `<top (required)>'
/usr/local/bundle/bin/sfn:23:in `load'
/usr/local/bundle/bin/sfn:23:in `<top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:463:in `exec'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:18:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

Thanks for opening the issue!

webframp commented 2 years ago

Thanks for reporting here @universam1 and @dhohengassner can you also share the template body and stackfile content (if using one)

dhohengassner commented 2 years ago

@webframp sure

We got the same error with multiple templates. The template we were able to reproduce and fix the error with a bogo pin was just this simple:

SparkleFormation.new(:template, provider: :aws) do
  description 'small test stack for sfn'
  dynamic!(:s3_bucket, 'sfntestbucket') do
    properties.bucket_name join!('sfntestbucket-', stack_name!)
  end
  outputs.bucket_name.value ref!(:sfntestbucket_s3_bucket)
end
chrisroberts commented 2 years ago

Fixed via spox/bogo#8. Sorry for the delay and thanks for the report!