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

Update to allow r10k.yaml configuration settings. (work of @barrymw) #310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cdenneen
Copy link

@cdenneen cdenneen commented Apr 1, 2021

This will allow for r10k.yaml to be added the the project root and read r10k specific configurations:

---
forge: {baseurl: 'https://artifactory.example.com/api/puppet/puppet'}

@barrymw added this in #166 so trying to get it into upstream for use now. Hacking controlrepo.rb isn't desired.

@cdenneen
Copy link
Author

cdenneen commented Apr 1, 2021

@dylanratcliffe I do not see a reason in this PR why these tests would fail. Can you check your full_tests?

@dylanratcliffe
Copy link
Collaborator

Hey so the testing is showing a legitimate error. If someone doesn't have an r10k.yaml file they get the following:

$ bundle exec onceover show puppetfile --debug --trace                                                                                                                                  

DEBUG    -> Reading /Users/dylan/git/puppet_controlrepo/environment.conf
DEBUG    -> Reading puppetfile from /Users/dylan/git/puppet_controlrepo

Error while running: #<R10K::Settings::Loader::ConfigError: Couldn't load config file: No such file or directory @ rb_sysopen - r10k.yaml>
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/r10k-3.8.0/lib/r10k/settings/loader.rb:69:in `rescue in read'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/r10k-3.8.0/lib/r10k/settings/loader.rb:66:in `read'
/Users/dylan/git/onceover/lib/onceover/controlrepo.rb:222:in `settings_from_config'
/Users/dylan/git/onceover/lib/onceover/controlrepo.rb:233:in `print_puppetfile_table'
/Users/dylan/git/onceover/lib/onceover/cli/show.rb:66:in `block (2 levels) in command'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cri-2.15.11/lib/cri/command.rb:362:in `run_this'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cri-2.15.11/lib/cri/command.rb:298:in `run'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cri-2.15.11/lib/cri/command.rb:316:in `run'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/cri-2.15.11/lib/cri/command.rb:316:in `run'
/Users/dylan/git/onceover/bin/onceover:7:in `<top (required)>'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/bin/onceover:23:in `load'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/bin/onceover:23:in `<top (required)>'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `load'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:28:in `run'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:463:in `exec'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:30:in `block in <top (required)>'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/dylan/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle:22:in `<top (required)>'
/Users/dylan/.rbenv/versions/2.5.7/bin/bundle:23:in `load'
/Users/dylan/.rbenv/versions/2.5.7/bin/bundle:23:in `<main>'

Seems like it's trying to read from the r10k.yaml file without checking to see if it exists first. Ideally it would use the r10k_config_file method to determine both the config file location, and whether or not it exists. That method implements the r10k config logic described in the readme which would mean it would match the behaviour of onceover run spec from an R10k perspective

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

Successfully merging this pull request may close these issues.

2 participants