Issue #9996 has been updated by Alexandre Fouche.
I have the same or similar problem, but since i use here-documents, '\' at end
of line is not an option.
I have a define, which basically does a /bin/cat of an here-document to a file.
It has always worked until puppet-2.7.3 included, but **fails with 2.7.4 and
2.7.5**. It uses parameter variables, but i can see in debug mode that they are
correctly known and expanded.
Here is the define:
define filesection($file, $sectionname, $lines='', $ensure = 'present') {
case $ensure {
present: {
exec { "exec add ${sectionname} $file":
path => ["/bin", "/usr/bin" ],
command => "/bin/cat <<EOF >>'${file}'
## PUPPET BEGIN ${sectionname}
${lines}
## PUPPET END ${sectionname}
EOF",
unless => "grep -qFx '## PUPPET BEGIN ${sectionname}' '${file}'"
}
}
# (...)
}
}
Here is the calling line:
filesection { 'bashrc-shopt-expand_aliases':
file => '/etc/bashrc',
sectionname => 'shopt-expand_aliases',
lines => 'shopt -s expand_aliases',
}
And here is the behaviour of different Puppet versions:
**2.7.3:**
notice:
/Stage[os]/Bashrc::Shopt::Expand_aliases/Filesection[bashrc-shopt-expand_aliases]/Exec[exec
add shopt-expand_aliases /etc/bashrc]/returns: executed successfully
**2.7.4 and 2.7.5 rpms:**
debug: Exec[exec add shopt-expand_aliases /etc/bashrc](provider=posix):
Executing check 'grep -qFx '## PUPPET BEGIN shopt-expand_aliases' '/etc/bashrc''
debug: Executing 'grep -qFx '## PUPPET BEGIN shopt-expand_aliases'
'/etc/bashrc''
debug: Exec[exec add shopt-expand_aliases /etc/bashrc](provider=posix):
Executing '/bin/cat <<EOF >>'/etc/bashrc'
## PUPPET BEGIN shopt-expand_aliases
shopt -s expand_aliases
## PUPPET END shopt-expand_aliases
EOF'
debug: Executing '/bin/cat <<EOF >>'/etc/bashrc'
## PUPPET BEGIN shopt-expand_aliases
shopt -s expand_aliases
## PUPPET END shopt-expand_aliases
EOF'
err:
/Stage[os]/Bashrc::Shopt::Expand_aliases/Filesection[bashrc-shopt-expand_aliases]/Exec[exec
add shopt-expand_aliases /etc/bashrc]/returns: change from notrun to 0 failed:
/bin/cat <<EOF >>'/etc/bashrc'
## PUPPET BEGIN shopt-expand_aliases
shopt -s expand_aliases
## PUPPET END shopt-expand_aliases
EOF returned 1 instead of one of [0] at
/etc/puppet/environments/production/manifests/classes/filesection.pp:15
----------------------------------------
Bug #9996: 2.7.5 and higher do not support multi-line strings in the 'command'
portion of 'exec'.
https://projects.puppetlabs.com/issues/9996
Author: Trevor Vaughan
Status: Unreviewed
Priority: High
Assignee:
Category:
Target version:
Affected Puppet version: 2.7.5
Keywords: exec, multi-line
Branch:
'Test' works, 'Test2' does not. I think that this worked in 2.7.4.
<pre>
exec { "test":
command => "/bin/echo '#Test' > /tmp/foo; /bin/echo 'bob' >> /tmp/foo;"
}
exec { "test2":
command => "/bin/echo '#Test' > /tmp/foo;
/bin/echo 'bob' >> /tmp/foo;"
}
</pre>
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.