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

Four commits #433

Merged
merged 5 commits into from
Mar 23, 2017
Merged

Four commits #433

merged 5 commits into from
Mar 23, 2017

Conversation

hunner
Copy link
Contributor

@hunner hunner commented Mar 23, 2017

This brings in the first 4 backwards-compatible commits of #428

Taylan Develioglu added 4 commits March 3, 2017 17:57
With path not a key attribute it's possible for multiple concat_file
resources to manage the same path.

For example, this compiles fine and creates a file:

-------foo.pp----------
concat_file { 'foo':
  ensure => present,
  path   =>  '/tmp/foo',
}

concat_file { 'bar':
  ensure => present,
  path   =>  '/tmp/foo',
}
-----------------------
tdevelioglu@traveler:/tmp$ puppet apply foo.pp
Notice: Compiled catalog for traveler.ams4.prod.booking.com in
environment production in 0.07 seconds
Notice: /Stage[main]/Main/File[/tmp/foo]/ensure: created
Notice: Applied catalog in 0.02 seconds

This makes :path the namevar for concat_file so we get:

tdevelioglu@traveler:/tmp$ puppet apply foo.pp
Error: Evaluation Error: Error while evaluating a Resource Statement,
Cannot alias Concat_file[bar] to ["/tmp/foo"] at /tmp/foo.pp:6; resource
["Concat_file", "/tmp/foo"] already declared at /tmp/foo.pp:1 at
/tmp/foo.pp:6:1 on node traveler.ams4.prod.booking.com
concat_file.

The order parameter does not restrict its values, making it easy for
simple mistakes to creep in.

This restricts the :order parameter to values that are valid (:alpha,
:numeric) so it fails early.
The replace parameter accepts an arbitrary string as opposed to the
file type's replace parameter.

This restricts the values to the same set that the file resource accepts
and replaces:

Error: /Stage[main]/Main/Concat_file[/tmp/foo]: Failed to generate
additional resources using 'generate': Parameter replace failed on
File[/tmp/foo]: Invalid value "foo". Valid values are true, false,
yes, no.
Error: /Stage[main]/Main/Concat_file[/tmp/foo]: Failed to generate
additional resources using 'eval_generate': undefined method `ref' for
nil:NilClass

with a more easily understandable:

Error: Parameter replace failed on Concat_file[/tmp/foo]: Invalid value
"foo". Valid values are true, false, yes, no.  at /tmp/foo.pp:1

It also lets :ensure_newline inherit Puppet::Parameter::Boolean to make
it consistent with the other parameters.
@hunner hunner mentioned this pull request Mar 23, 2017
@eputnam eputnam merged commit 3e1841b into puppetlabs:master Mar 23, 2017
@hunner hunner deleted the add_tdevelioglu branch March 23, 2017 22:17
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