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

Bolt shouldn't stack trace if config is invalid #2337

Closed
lucywyman opened this issue Nov 11, 2020 · 0 comments · Fixed by #2345
Closed

Bolt shouldn't stack trace if config is invalid #2337

lucywyman opened this issue Nov 11, 2020 · 0 comments · Fixed by #2345
Assignees
Labels
Bug Bug reports and fixes.

Comments

@lucywyman
Copy link
Contributor

lucywyman commented Nov 11, 2020

Describe the Bug

Bolt will stack trace with the following config file (or any instance of puppetfile with no content) when running any command:

---
puppetfile:
lucy ~/githubs/bolt/project ((0ed604c...)) $ be bolt puppetfile install
bundler: failed to load command: bolt (/home/lucy/githubs/bolt/vendor/bundle/ruby/2.6.0/bin/bolt)
NoMethodError: undefined method `slice' for nil:NilClass
  /home/lucy/githubs/bolt/lib/bolt/config.rb:337:in `finalize_data'
  /home/lucy/githubs/bolt/lib/bolt/config.rb:254:in `initialize'
  /home/lucy/githubs/bolt/lib/bolt/config.rb:51:in `new'
  /home/lucy/githubs/bolt/lib/bolt/config.rb:51:in `from_project'
  /home/lucy/githubs/bolt/lib/bolt/cli.rb:177:in `load_config'
  /home/lucy/githubs/bolt/lib/bolt/cli.rb:95:in `parse'
  /home/lucy/githubs/bolt/exe/bolt:10:in `<top (required)>'
  /home/lucy/githubs/bolt/vendor/bundle/ruby/2.6.0/bin/bolt:23:in `load'
  /home/lucy/githubs/bolt/vendor/bundle/ruby/2.6.0/bin/bolt:23:in `<top (required)>'

Yes - we should have a more general solution.

@lucywyman lucywyman added the Bug Bug reports and fixes. label Nov 11, 2020
@lucywyman lucywyman changed the title Stacktrace when puppetfile config has no value Bolt shouldn't stack trace if config is invalid Nov 11, 2020
@lucywyman lucywyman added this to 📝 To Do in Bolt Kanban via automation Nov 11, 2020
@beechtom beechtom moved this from 📝 To Do to ⚡️ Doing in Bolt Kanban Nov 11, 2020
@beechtom beechtom self-assigned this Nov 11, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 12, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 13, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 13, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 13, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 13, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
@beechtom beechtom moved this from ⚡️ Doing to 🚧 Reviewing in Bolt Kanban Nov 13, 2020
beechtom added a commit to beechtom/bolt that referenced this issue Nov 16, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 16, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 16, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
@lucywyman lucywyman removed this from 🚧 Reviewing in Bolt Kanban Nov 16, 2020
@beechtom beechtom linked a pull request Nov 16, 2020 that will close this issue
beechtom added a commit to beechtom/bolt that referenced this issue Nov 17, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
beechtom added a commit to beechtom/bolt that referenced this issue Nov 17, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
lucywyman added a commit that referenced this issue Nov 17, 2020
dontlaugh pushed a commit to dontlaugh/bolt that referenced this issue Dec 18, 2020
This adds a new `Bolt::Config::Validator` class which validates config
against a schema. The validator will recurse through the config and
schema, validating each value against the corresponding definition in
the schema. If validation fails for a given value, the validator will
add a message to a list of errors. After the entire config has been
validated, and if any invalid values were detected, the validator will
raise an error that lists all of the invalid values.

The validator provides basic validation for config values, such as type
checking, ensuring required keys are present, and that items in an array
are unique. It does not provide more complex validation such as ensuring
a file exists at a given path or that a URL can be reached.

!feature

* **Improved config validation**
  ([puppetlabs#2337](puppetlabs#2337))

  Bolt now validates config files against Bolt's schemas and indicates
  which config file an error is found in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug reports and fixes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants