Puppet string manipulation failed

Hi,

Not sure what is wrong with the below configuration

sh-4.2# cat /etc/puppetlabs/code/environments/production/manifests/demo.pp
node stapp03.stratos.xfusioncorp.com {
  file_line { 'replace line':    path => '/opt/devops/demo.txt',
    line => 'Welcome to xFusionCorp Industries!',
    match   => "Welcome to Nautilus Industries!",
  }
}

The line looks replaced as I took a backup first just in case

[banner@stapp03 ~]$ diff demo.txt /opt/devops/demo.txt
2c2
< Welcome to Nautilus Industries!
---
> Welcome to xFusionCorp Industries!
[banner@stapp03 ~]$  

yeah, unfortunately I didn’t save the question as it doesn’t show it anymore once the task is failed, but I’m almost sure that the data in there is correct.

Here’s the failed message

Something is wrong with demo.pp as /opt/devops/demo.txt file does not contain correct data on App Server 3

@wael.sadek This is marked Success for you.

@Inderpreet , wow , thanks a lot for your fast response !!

your solution is wrong and actually misleading others, in fact you have wrongly configured your lines
line => ‘Welcome to xFusionCorp Industries!’,
match => “Welcome to Nautilus Industries!”,

these two should be exactly different.

file_line { 'replace':
    path      => $line::path_to_conf,
    replace => true,
    line       => $line::new_line_to_use,
    match  => $line::exact_match_for_old_line
  }

@nashwan,

Not sure what you mean, I got it from the puppet documentation :

Could you please explain ?

@wael.sadek the questions says replace
Welcome to Nautilus Industries!
with
Welcome to xFusionCorp Industries!

so the correct config is:
line => Welcome to xFusionCorp Industries!,
match => Welcome to Nautilus Industries!,

while your config is exactly opposite. so obviously you wont get a desired result.

@nashwan,

No, please check the diff output the old file differs from the new one.
Your task may be different than mine it doesn’t have to be the same.

Hi,

I have this task Puppet String Manipulation but can’t complete it as puppetserver service on the puppetmaster (jumphost) is not starting and my task will soon expire.

I have tried reducing and increasing the memory configuration “java -Xms2g -Xmx2g” and also changing ownership of “/opt/puppetlabs/server/data/puppetserver” to puppet:puppet to no avail.

Please review this and mark this task pending for me.

See image for error (I am a new user here and can only attached one image):

Hi @sysionng

We are already looking into this issue, will keep you updated.