Ask Your Question

file_line with noop mode

asked 2018-10-29 10:56:13 -0600

Crack gravatar image

Is it possible for file_line to work correctly with noop mode? I want to change a few settings in a file that gets pulled by a package (sentinel.conf from redis-sentinel), while still allowing for noop to work correctly (i.e. not failing entire process).

Simplified use case boils down to:

file { '/tmp/test1': # real code uses package{'redis-server': ...} here
  ensure  => present,
  content => 'test'
-> file_line { 'test1_change':
  path   => '/tmp/test1',
  line   => "test ok",
  match  => '^test',
  require => File['/tmp/test1']

which fails with

Debug: /Stage[main]/Main/File[/tmp/test1]/before: before to File_line[test1_change]
Debug: /Stage[main]/Main/File_line[test1_change]/require: require to File[/tmp/test1]
Notice: /Stage[main]/Main/File[/tmp/test1]/ensure: current_value 'absent', should be 'present' (noop)
Debug: /Stage[main]/Main/File[/tmp/test1]: The container Class[Main] will propagate my refresh event
Error: /Stage[main]/Main/File_line[test1_change]: Could not evaluate: No such file or directory @ rb_sysopen - /tmp/test1

Puppet 6.0.3, stdlib 5.1.0.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-10-31 07:43:50 -0600

For modules published by Puppet Inc. you can search file_line noop in on your own. You'll see this is a “won't fix” issue.

edit flag offensive delete link more


*sad face* - I understand why, but that's still kindof odd/painful/unfortunate.

DarylW gravatar imageDarylW ( 2018-10-31 08:54:01 -0600 )edit

But it's consistent. I don't wanna manipulate stdlib/lib/puppet/provider/file_line/ruby.rb in order to support noop.

Kai Burghardt gravatar imageKai Burghardt ( 2018-10-31 10:30:02 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-10-29 10:55:20 -0600

Seen: 217 times

Last updated: Oct 31