Yes, I was planning to have a separate type for other ssm commands. But I got stuck with the current problem as I am not able to add any parameter beside existing.
On Thursday, May 25, 2017 at 1:44:15 PM UTC-4, Shawn Ferry wrote: > > > On May 25, 2017, at 1:19 PM, ggun <gaurav...@gmail.com <javascript:>> > wrote: > > Thank you, I will try the first option. I remember doing that but it did > not avoid the warnings. But I will retry. > > There is one last help I am looking for. if you have time to look into > below issue. > > https://groups.google.com/forum/#!topic/puppet-dev/9tkiructtYI > <https://groups.google.com/forum/#!topic/puppet-dev/9tkiructtYI> > > I have just added new parameter in the type and used the parameter command > and also mention in the init.pp ssm module call, but the module fails with > error > Error: no parameter named 'command' at > /etc/puppetlabs/code/environments/production/modules/xxx/manifests/init.pp:67 > on Ssm[RHELDiskManager] at > /etc/puppetlabs/code/environments/production/modules/xx/manifests/init.pp:67 > on node xxx > > This issue is happening for any new parameter that I am trying to add. Is > there a limit to the parameter that I can use in the type ? I don't think I > am overusing them. But don't know why is it failing > > > At a glance I don’t see anything that stands out for why it isn’t working > for you > > > > I think in general you shouldn’t call it a parameter command because it > may be confusing. I think it should work but maybe ‘operation’ instead. > You will also need to either add some generic arguments option to be able > to form complete commands or create a bunch of optional parameters that > apply only to the different operations. > > I don’t think this the correct approach. > > > You want to create multiple types e.g. ssm_create ssm_resize maybe > ssm_snapshot ssm_remove since they all have separate arguments and logic. > Trying to overload all of it into a single type is going to be harder the > further you go. > > > > > > > On Thursday, May 25, 2017 at 12:17:09 PM UTC-4, Shawn Ferry wrote: >> >> >> On May 24, 2017, at 10:02 PM, ggun <gaurav...@gmail.com> wrote: >> >> 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)* >> >> >> There are any number of bits of software that call themselves ssm. >> Assuming this is system storage manager why don’t you pass -f to make it >> non-interactive? >> >> commands => :ssm => ‘/usr/bin/ssm’ >> *args=%W[-f create --fs @resource[:fs_type] -p @resource[:volume_group] >> -n @resource[:logical_volume] @resource[:mount_point]]* >> ssm(*args) >> >> >> If that isn’t an option you could pass a file containing ‘yes’ >> *cmd=%W[ssm create --fs @resource[:fs_type] -p @resource[:volume_group] >> -n @resource[:logical_volume] @resource[:mount_point]]* >> Puppet::Util::Execution.execute(cmd, :stdinfile => ‘/path/to/yes-file’) >> >> >> >> >> 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)’) >> >> >> You really shouldn’t do that. Your invocation is off. The system call is >> not using you definition >> of ssm above it’s just finding it on the path and you need to expand your >> args system takes a string. >> >> args=%w(this is s a test) >> [5] pry(main)> system("yes | echo #{args.join(' ')}") >> this is s a test >> >> 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 puppet-dev+...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-dev/6b4548f5-df77-45b8-b6de-849c6ba6144d%40googlegroups.com >> >> <https://groups.google.com/d/msgid/puppet-dev/6b4548f5-df77-45b8-b6de-849c6ba6144d%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> > -- > 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 puppet-dev+...@googlegroups.com <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/66eba19b-7926-4f77-a65d-92887937c7a7%40googlegroups.com > > <https://groups.google.com/d/msgid/puppet-dev/66eba19b-7926-4f77-a65d-92887937c7a7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- 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 puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/824cbd6e-b63a-4012-b140-b00ec016d488%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.