-
Notifications
You must be signed in to change notification settings - Fork 227
(GH-1779) Warn when Bolt is installed as a gem #1797
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
Conversation
This adds a warning that Bolt may be installed as a gem when bundled content is missing. Bolt checks if any modules other than `aggregate`, `canary`, and `puppetdb_fact` are installed at `Bolt::PAL::MODULES_PATH` to determine if it may be a gem install. This warning can be disabled by setting the `BOLT_GEM` environment variable to `false`. !feature * **Warn when Bolt is installed as a gem** ([puppetlabs#1779](puppetlabs#1779)) Bolt now issues a warning when it detects that it may have been installed as a gem. This warning can be disabled by setting the `BOLT_GEM` environment to `false`. To install Bolt reliably and with all of its dependencies, it should be [installed as a package](https://puppet.com/docs/bolt/latest/bolt_installing.html).
lib/bolt/cli.rb
Outdated
|
|
||
| def bundled_content | ||
| # If the bundled content directory is empty, Bolt is likely installed as a gem. | ||
| if ENV['BOLT_GEM'] != 'false' && gem_install? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ticket said "when BOLT_GEM is anything but true", which seemed weird as we'd need to first check that it wasn't nil. Since a user will need to explicitly set this variable to disable the warning, I felt that requiring the value to be false made sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think common practice with variables like these is to simply require they be set. That is, setting BOLT_GEM means "I know I'm running from a gem install and that's okay".
|
CLA signed by all contributors. |
nicklewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to set BOLT_GEM in the Gemfile so you don't get this warning when running from source? Or is the warning useful because it reminds you that you may need to r10k puppetfile install?
lib/bolt/cli.rb
Outdated
|
|
||
| def bundled_content | ||
| # If the bundled content directory is empty, Bolt is likely installed as a gem. | ||
| if ENV['BOLT_GEM'] != 'false' && gem_install? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think common practice with variables like these is to simply require they be set. That is, setting BOLT_GEM means "I know I'm running from a gem install and that's okay".
This adds a warning that Bolt may be installed as a gem when bundled
content is missing. Bolt checks if any modules other than
aggregate,canary, andpuppetdb_factare installed atBolt::PAL::MODULES_PATHto determine if it may be a gem install.
This warning can be disabled by setting the
BOLT_GEMenvironmentvariable.
Closes #1779
!feature
Warn when Bolt is installed as a gem
(#1779)
Bolt now issues a warning when it detects that it may have been
installed as a gem. This warning can be disabled by setting the
BOLT_GEMenvironment variable.To install Bolt reliably and with all of its dependencies, it should
be installed as a package.