Jason Greathouse
2013-Oct-02 22:27 UTC
[Puppet Users] exec is stripping "%" in the string.
I''m trying to pass a url to an exec and at some point all the % characters are being stripped out of the string. Here''s my init.pp: service { ''apache2'': ensure => running, enable => true, notify => Exec[''AWSwait''] } file { ''/mnt/WaitResponse.json'': ensure => file, owner => ''root'', group => ''root'', mode => ''0644'', source => ''puppet:///modules/api/WaitResponse.json'' } exec { "/usr/bin/curl -T /mnt/WaitResponse.json \"${::mt_wait}\"": onlyif => ''/usr/bin/wget -q -O /mnt/favicon.ico http://localhost/favicon.ico'', creates => ''/mnt/favicon.ico'', alias => ''AWSwait'', require => File[''/mnt/WaitResponse.json''] } ::mt_wait is being generated by a custom facter script: # facter mt_wait https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-1%3A106261427813%3Astack/api-qa-puppet-7/e9e86e20-2bac-11e3-8a8b-50e2416294a8/WaitHandle?Expires=1380837161&AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXXXXXX The Scheduling refresh looks correct: puppet-agent[5779]: (/Stage[main]/Api/Service[apache2]) Scheduling refresh of Exec[/usr/bin/curl -T /mnt/WaitResponse.json "https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-1%3A106261427813%3Astack/api-qa-puppet-7/e9e86e20-2bac-11e3-8a8b-50e2416294a8/WaitHandle?Expires=1380837161&AWSAccessKeyId=XXXXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXXX"] But when it Exec Refresh runs, the "%" are missing: puppet-agent[5779]: (/Stage[main]/Api/Exec[/usr/bin/curl -T /mnt/WaitResponse.json "https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn3Aaws3Acloudformation3Aus-east-13A1062614278133Astack/api-qa-puppet-7/e9e86e20-2bac-11e3-8a8b-50e2416294a8/WaitHandle?Expires=1380837161&AWSAccessKeyId=XXXXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXX"]) Triggered ''refresh'' from 1 events Is there a better way to pass the variable to exec then a double-quote or someway to escape the "%"? Thanks, -Jason -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Hi, the most robust way to have puppet execute complex commands is to have puppet deploy a trivial script comprising the command, then execute the script sans arguments. HTH, Felix On 10/03/2013 12:27 AM, Jason Greathouse wrote:> I''m trying to pass a url to an exec and at some point all the % > characters are being stripped out of the string. > > Here''s my init.pp: > > service { ''apache2'': > ensure => running, > enable => true, > notify => Exec[''AWSwait''] > } > > file { ''/mnt/WaitResponse.json'': > ensure => file, > owner => ''root'', > group => ''root'', > mode => ''0644'', > source => ''puppet:///modules/api/WaitResponse.json'' > } > > exec { "/usr/bin/curl -T /mnt/WaitResponse.json \"${::mt_wait}\"": > onlyif => ''/usr/bin/wget -q -O /mnt/favicon.ico > http://localhost/favicon.ico'', > creates => ''/mnt/favicon.ico'', > alias => ''AWSwait'', > require => File[''/mnt/WaitResponse.json''] > } > > ::mt_wait is being generated by a custom facter script: > > # facter mt_wait > https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-1%3A106261427813%3Astack/api-qa-puppet-7/e9e86e20-2bac-11e3-8a8b-50e2416294a8/WaitHandle?Expires=1380837161&AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXXXXXX > > > The Scheduling refresh looks correct: > puppet-agent[5779]: (/Stage[main]/Api/Service[apache2]) Scheduling > refresh of Exec[/usr/bin/curl -T /mnt/WaitResponse.json > "https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-east-1%3A106261427813%3Astack/api-qa-puppet-7/e9e86e20-2bac-11e3-8a8b-50e2416294a8/WaitHandle?Expires=1380837161&AWSAccessKeyId=XXXXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXXX"] > > But when it Exec Refresh runs, the "%" are missing: > puppet-agent[5779]: (/Stage[main]/Api/Exec[/usr/bin/curl -T > /mnt/WaitResponse.json > "https://cloudformation-waitcondition-us-east-1.s3.amazonaws.com/arn3Aaws3Acloudformation3Aus-east-13A1062614278133Astack/api-qa-puppet-7/e9e86e20-2bac-11e3-8a8b-50e2416294a8/WaitHandle?Expires=1380837161&AWSAccessKeyId=XXXXXXXXXXXXXXXX&Signature=XXXXXXXXXXXXXXXXXX"]) > Triggered ''refresh'' from 1 events > > Is there a better way to pass the variable to exec then a double-quote > or someway to escape the "%"? > > Thanks, > -Jason-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.