Skip to content

(PUP-8767) Emit config version as a string#6856

Merged
joshcooper merged 3 commits intopuppetlabs:5.5.xfrom
joshcooper:PUP-8767-config_version_yaml
Jun 5, 2018
Merged

(PUP-8767) Emit config version as a string#6856
joshcooper merged 3 commits intopuppetlabs:5.5.xfrom
joshcooper:PUP-8767-config_version_yaml

Conversation

@joshcooper
Copy link
Copy Markdown
Contributor

If config_version was an executable, then we emitted the YAML tag for a Puppet::Util::Execution::ProcessOutput class in the last run summary. Capture the config version output as a String instead. Also update specs to accurate reflect what the execute method returns.

@joshcooper joshcooper force-pushed the PUP-8767-config_version_yaml branch from 6a246be to 061b566 Compare May 25, 2018 19:57
rhowe-gds and others added 3 commits May 25, 2018 14:44
If you run puppet apply --config_version='echo foo' then the last run
summary YAML ends up looking like this

---
version:
  config: !ruby/string:Puppet::Util::Execution::ProcessOutput "foo"
[...]

Stringify the process output in order to make the YAML less dependent on Ruby.
Add a test to ensure config_version is a string and is not a
ProcessOutput which subclasses String.
Return a ProcessOutput object to match what the execute method actually does.
@puppetcla
Copy link
Copy Markdown

CLA signed by all contributors.

@@ -208,7 +208,7 @@ def version
if environment.config_version.nil? || environment.config_version == ""
@version = Time.now.to_i
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be to_s as well, just for consistency's sake?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We allow either string or integer in the schema, so I think it's ok as is.

@joshcooper joshcooper merged commit a5825b4 into puppetlabs:5.5.x Jun 5, 2018
@joshcooper joshcooper deleted the PUP-8767-config_version_yaml branch June 5, 2018 22:34
@joshcooper
Copy link
Copy Markdown
Contributor Author

Thanks for your contribution @rhowe-gds! This will be released in the near future in the 5.5.x series.

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