On Monday, March 20, 2017 at 10:09:48 AM UTC-5, Pratip Ghosh wrote:
>
> Hi,
>
> I am facing following error to copy full content of directory in multiple 
> location.
>
> Error: Failed to apply catalog: Parameter command failed on Exec[copy]: 
> Command must be a String, got value of class Array at 
> /etc/puppet/modules/wordpress/manifests/wp.pp:23
>


So what's your confusion?  This is about the clearest error message you 
could hope for.  Puppet complains that it requires the 'command' parameters 
of Exec resources to be strings, but that that parameter of the Exec 
resource entitled 'copy' is instead an array.  It even provides the line 
number in your manifest, and the parameter's assigned value indeed is an 
array:
 

>     exec { 'copy':
>         command => ["cp -r /tmp/wordpress/* /var/www/abc_com","cp -r 
> /tmp/wordpress/* /var/www/xyz_com"],
>         require => Exec['extract'],
>         path => ['/bin'],
>     }
>

If you want to execute two separate `cp` commands, then you have several 
options; among the best are:

   - Split them into two Exec resources
   - Join them into a single string via a semicolon, and add provider => 
   'shell' to the Exec's parameters
   - Create a script containing the commands, ensure it present on the 
   target machine, and execute the script vie an Exec resource


John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c1d0045d-0f31-4a63-995a-4f65262907f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to