Hi Experts,
Need your kind help in command to execute in the puppet provider. Below is
the code snippet of the puppet provider code.
If I run the code with changes as below the *code* runs without any issue
*cmd="yes | #{create_ssm} create --fs '#{@resource[:fs_type]}' -p
'#{@resource[:volume_group]}' -n '#{@resource[:logical_volume]}'
'#{@resource[:mount_point]}'"*
*system(cmd)*
But when I run code as below
system('yes | ssm(*args)') # I am building args based on input and ssm
is the commands as shown in below code snippet
puppet run fails with error as
*Error*
sh: -c: line 0: syntax error near unexpected token `*args'
sh: -c: line 0: `yes | ssm(*args)'
Please help can I fix above run.
*Code Snippets *
commands :ssm => '/usr/bin/ssm',
def create
puts "Creating FileSystem"
args = ['create']
if @resource[:fs_type]
args.push('--fs', @resource[:fs_type])
else
args.push('--fs', 'xfs')
end
if @resource[:volume_group]
args.push('-p', @resource[:volume_group])
else
puts "Default volume group will be creted and user needs to manage it"
end
if @resource[:logical_volume]
args.push('-n', @resource[:logical_volume])
else
puts "Default logical volume will be creted and user needs to manage
it"
end
if @resource[:device]
args << @resource[:device]
end
if @resource[:mount_point]
FileUtils.mkdir_p(@resource[:mount_point]) unless
File.exists?(@resource[:mount_point])
args << @resource[:mount_point]
end
p args
# p cmd
system('yes | ssm(*args)')
rescue Puppet::ExecutionFailure => detail
raise Puppet::Error, "Could not create filesystem, volume group,and
logical group. Due to error:(#{detail.message})"
end
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/6b4548f5-df77-45b8-b6de-849c6ba6144d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.