Skip to content

(PUP-7582) Error on virtual and exported classes#8346

Merged
GabrielNagy merged 1 commit intopuppetlabs:mainfrom
joshcooper:class_virtual_export2_7582
Oct 6, 2020
Merged

(PUP-7582) Error on virtual and exported classes#8346
GabrielNagy merged 1 commit intopuppetlabs:mainfrom
joshcooper:class_virtual_export2_7582

Conversation

@joshcooper
Copy link
Copy Markdown
Contributor

Previously puppet would warn or error if it encountered a virtual
class (indicated by @class) or an exported class (indicated by @@class)
based on the Puppet[:strict] setting. By default, puppet would warn, yet
include resources from the virtual class in the catalog. So the resources in the
virtual class weren't virtual! Also note, it wasn't possible to turn off the
warning.

This commit makes puppet always error on virtual and exported classes. The
validator_factory_4_0.rb validates static resource expressions, while
runtime3_support validates create_resources calls, which can be used to create
resources at runtime, so we need to prevent things like:

create_resources('@class', {})

The integration tests are removed since we already test for validation errors in
unit tests.

@joshcooper joshcooper requested review from a team September 30, 2020 18:20
@joshcooper
Copy link
Copy Markdown
Contributor Author

jenkins please test this with servertests

@joshcooper
Copy link
Copy Markdown
Contributor Author

Travis is failing due to a facter detecting travis as AWS due to puppetlabs/facter#2095

Acceptance is failing due to #8340, which is also blocked on the facter issue

@puppetcla
Copy link
Copy Markdown

CLA signed by all contributors.

Previously puppet would warn or error if it encountered a virtual
class (indicated by `@class`) or an exported class (indicated by `@@class`)
based on the `Puppet[:strict]` setting. By default, puppet would warn, yet
include resources from the virtual class in the catalog. So the resources in the
virtual class weren't virtual! Also note, it wasn't possible to turn off the
warning.

This commit makes puppet always error on virtual and exported classes. The
validator_factory_4_0.rb validates static resource expressions, while
runtime3_support validates `create_resources` calls, which can be used to create
resources at runtime, so we need to prevent things like:

    create_resources('@Class', {})

The integration tests are removed since we already test for validation errors in
unit tests.
@joshcooper joshcooper force-pushed the class_virtual_export2_7582 branch from c0cd46f to 0befcf3 Compare October 1, 2020 21:46
@joshcooper
Copy link
Copy Markdown
Contributor Author

jenkins please test this with servertests

Copy link
Copy Markdown
Contributor

@ciprianbadescu ciprianbadescu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ciprianbadescu ciprianbadescu requested a review from a team October 2, 2020 10:43
@joshcooper joshcooper closed this Oct 2, 2020
@joshcooper joshcooper reopened this Oct 2, 2020
@GabrielNagy GabrielNagy merged commit cb9319f into puppetlabs:main Oct 6, 2020
@joshcooper joshcooper deleted the class_virtual_export2_7582 branch April 15, 2021 03:36
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.

4 participants