Skip to content

Conversation

@silug
Copy link
Contributor

@silug silug commented Jun 15, 2022

In noop mode, file_line should not fail if the file does not exist.

MODULES-2892 #close

In noop mode, file_line should not fail if the file does not exist.

MODULES-2892 #close
@silug silug requested a review from a team as a code owner June 15, 2022 19:51
@CLAassistant
Copy link

CLAassistant commented Jun 15, 2022

CLA assistant check
All committers have signed the CLA.

@silug
Copy link
Contributor Author

silug commented Jun 15, 2022

Without this change:

$ puppet apply -e 'file { "/tmp/no_such_file": ensure => present } -> file_line { "foo": ensure => present, path => "/tmp/no_such_file", line => "foo" }' --modulepath spec/fixtures/modules --noop
Notice: Compiled catalog for localhost in environment production in 0.02 seconds
Notice: /Stage[main]/Main/File[/tmp/no_such_file]/ensure: current_value 'absent', should be 'present' (noop)
Error: /Stage[main]/Main/File_line[foo]: Could not evaluate: No such file or directory @ rb_sysopen - /tmp/no_such_file
Notice: Applied catalog in 0.01 seconds

With the change:

$ puppet apply -e 'file { "/tmp/no_such_file": ensure => present } -> file_line { "foo": ensure => present, path => "/tmp/no_such_file", line => "foo" }' --modulepath spec/fixtures/modules --noop
Notice: Compiled catalog for localhost in environment production in 0.02 seconds
Notice: /Stage[main]/Main/File[/tmp/no_such_file]/ensure: current_value 'absent', should be 'present' (noop)
Notice: /Stage[main]/Main/File_line[foo]/ensure: current_value 'absent', should be 'present' (noop)
Notice: Class[Main]: Would have triggered 'refresh' from 2 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 event
Notice: Applied catalog in 0.01 seconds

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Slight nit on coding style, otherwise 👍

@ekohl
Copy link
Collaborator

ekohl commented Jun 16, 2022

Looks good to me. I started the tests. Please ping if I (or some other maintainer) forgets to check back and merge.

@ekohl ekohl merged commit b97c657 into puppetlabs:main Jun 16, 2022
@silug silug deleted the MODULES-2892 branch June 16, 2022 17:08
@chelnak chelnak added the bugfix label Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants