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

(PDK-1614) Add project.environment settings #857

Merged
merged 1 commit into from
Feb 24, 2020

Conversation

glennsarti
Copy link
Contributor

Now that the PDK can read the environment.conf file, it can be updated to
display that the user, and be consumed by the Control Repo context. This commit:

  • Adds a helper method to PDK::ControlRepo to create an an object to read/edit
    an arbitrary environment.conf file. The helper method also adds the default
    settings as per Puppet documentation
  • Updates the PDK::Config class to take in a PDK Context. The configuration
    settings then are mutated depending on the Context, for example, the
    'puppet.environment.*' settings now exist if the user is in a Control Repo,
    and won't if they're in a Module.

Note that because PDK::Config now depends on a PDK::Context object being
passed in (or default via PDK.context), any method calls to configuration
information (ala PDK.config) are not allowed and can cause circular
references and stack overflows. Thus there is a helper class to create the
environment.conf IniFile object.

Note that right now there is no project-level PDK configuration file therefore
the mock configuration RSpec context does not mock this and that the
PDK::Config.project_config method has no filename associated with it. Future
commits may add this feature.

@glennsarti glennsarti requested a review from a team as a code owner February 21, 2020 04:49
@coveralls
Copy link

coveralls commented Feb 21, 2020

Coverage Status

Coverage increased (+0.04%) to 91.368% when pulling f14a252 on glennsarti:modify-repo-context into 41c7fcc on puppetlabs:master.

Copy link
Contributor

@rodjek rodjek left a comment

Choose a reason for hiding this comment

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

1 comment nit, otherwise 👍

lib/pdk/context/control_repo.rb Outdated Show resolved Hide resolved
Now that the PDK can read the environment.conf file, it can be updated to
display that the user, and be consumed by the Control Repo context. This commit:

* Adds a helper method to PDK::ControlRepo to create an an object to read/edit
  an arbitrary environment.conf file.  The helper method also adds the default
  settings as per Puppet documentation
* Updates the PDK::Config class to take in a PDK Context. The configuration
  settings then are mutated depending on the Context, for example, the
  'puppet.environment.*' settings now exist if the user is in a Control Repo,
  and won't if they're in a Module.

Note that because PDK::Config now depends on a PDK::Context object being
passed in (or default via PDK.context), any method calls to configuration
information (ala PDK.config) are not allowed and can cause circular
references and stack overflows. Thus there is a helper class to create the
environment.conf IniFile object.

Note that right now there is no project-level PDK configuration file therefore
the mock configuration RSpec context does not mock this and that the
PDK::Config.project_config method has no filename associated with it.  Future
commits may add this feature.
@glennsarti
Copy link
Contributor Author

Typo fixed. Merging!

@glennsarti glennsarti merged commit 6b2e642 into puppetlabs:master Feb 24, 2020
@rodjek rodjek added this to the February 2020 milestone Feb 26, 2020
@rodjek rodjek added the feature label Feb 26, 2020
@glennsarti glennsarti deleted the modify-repo-context branch March 5, 2020 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants