[Puppet-dev] Complex Hiera Structure need help

2017-08-23 Thread ggun
Hi Experts,
I need some help in using the complex hiera designed here.
Current puppet version is - 4.7

Use case:
Below is the hiera data

was_data:
  was_default_data:
hs3sourcepath: 'websphere'
hwsgroupgid: '405'
hmwuserid: '404'
hmwusergrpid: '405'  
hdaresponse_file: 'xx'
hibmagentpath: 'xxx'
hbase_dir: _dir 'xx'
hinstance_name: _name 'WebSphere'
prereq_packages:
  - 'xorg-x11-apps'
  - 'xorg-x11-utils' 
hdmgr_servername: 'xxx'
  was_dmgr_data:
esa-group-service:
  use_dmgr_profile: 'no'
  pptdmgrsrvsptpath: '/opt/was/ResponseFiles/ESG_DMGR_Creation.txt'
  hdmgr_profile: ESGTSTDMGR01
  hdmgr_cell: ESGTSTCELL01
  hcluster_name: ESGTSTCLUSTER
  hpptdmgrsrvport: xxx
  manage_jdbc_provider: 
hscope: 'cluster'
hdbtype: 'Oracle'
hprovidertype: 'Oracle JDBC Driver'
himplementation: 'Connection pool data source'
hclasspath: '/opt/was/oracle/ojdbc6.jar'
   esa-user-profile-service:   
use_dmgr_profile: 'yes'
pptdmgrsrvsptpath: '/opt/was/ResponseFiles/ESG_DMGR_Creation.txt'
hdmgr_profile: ESGTSTDMGR01
hdmgr_cell: ESGTSTCELL01
hcluster_name: EUPSTSTCLUSTER
hpptdmgrsrvport: xxx

Now I iterate through the was_dmgr_data as given below

   if ! empty($was_dmgr_data) {
  $was_dmgr_data.map |$wasdatakey,$wasdatavalue| {
glic_websphere::glic_dmgr::manage_dmgr { "DMGR Management for 
${wasdatakey}":
  *  => $wasdatavalue,
  base_dir   => $hbase_dir,
  instance_name  => $hinstance_name,
  wasdatakey => $wasdatakey,   
}  
  }  
} 

Now if you see I have added additional has to the hash  as 
'manage_jdbc_provider' and will be adding one more hash 
'manage_jdbc_datasource'

I need to iterate to one more type if the 'manage_jdbc_provider' hash is 
present. I created a type as shown below 


   if ! empty($was_dmgr_data) {
  $was_dmgr_data.map |$wasdatakey,$wasdatavalue| {
glic_websphere::glic_dmgr::manage_dmgr { "DMGR Management for 
${wasdatakey}":
  *  => $wasdatavalue,
  base_dir   => $hbase_dir,
  instance_name  => $hinstance_name,
  wasdatakey => $wasdatakey,   
}  
if has_key($wasdatavalue, 'manage_jdbc_provider') {
glic_websphere::glic_dmgr::manage_jdbc_provider {"JDBC Management 
for ${wasdatakey}":
*  => $wasdatavalue,
base_dir   => $hbase_dir,
instance_name  => $hinstance_name,

  }
}
  }  
} 

But the problem here I need to have all the input parameters also define in 
manage_jdbc_provider that are in 'esa-group-service' . How can I pass only 
specific and require hash data or string data to the type. The hash name 
such as 'esa-group-service' or 'esa-user-profile-service'  is dynamic .

-- 
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/d428f965-35c8-4920-a570-60345ce79981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] Re: Hiera Merge

2017-08-10 Thread ggun
Thanks, but the main point to merge the hash is that the sub hash header 
value is not fixed in the example I have mentioned as  
esa-user-profile-service or esa-group-service.  It can be anything. I need 
to make the code free from using direct Key value .

On Wednesday, August 9, 2017 at 2:24:34 PM UTC-4, Reid Vandewiele wrote:
>
> If you're just trying to transform the data in Puppet code and assuming 
> (as Henrik was) that you can't change how the data is stored, something 
> like this might work.
>
> # Assuming $was_data is the hash of data from Hiera
> $common_data = $was_data.filter |$pair| { $pair[0] != 'was_dmgr_data' }
> $hash1 = {'esa-group-service'=> $common_data + 
> $was_data['was_dmgr_data']['esa-group-service'] }
> $hash2 = {'esa-user-profile-service' => $common_data + 
> $was_data['was_dmgr_data']['esa-user-profile-service'] }
>
> ~Reid
>
> On Wednesday, August 9, 2017 at 6:15:41 AM UTC-7, ggun wrote:
>>
>> Thanks
>>
>> On Tuesday, August 8, 2017 at 7:10:13 PM UTC-4, ggun wrote:
>>>
>>> Hi Experts,
>>>
>>> I have a requirement as below.
>>> I need to create a Hash from below hiera data.
>>>
>>> was_data:
>>>   hs3sourcepath: 'glic.binaries/websphere'
>>>   hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
>>>   hibmagentpath: 
>>> /opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
>>>   hbase_dir: '/opt/was/was855'
>>>   hinstance_name: WebSphere
>>>   was_dmgr_data:
>>> esa-group-service:  
>>>   hgroup: websph
>>>   hdmgr_profile: TST
>>>   hdmgr_cell: CELL
>>>   hcluster_name: CLUSTER
>>>   hpptdmgrsrvport: 8080
>>> esa-user-profile-service:
>>>   hdmgr_profile: ABC
>>>   hdmgr_cell: PQS
>>>   hcluster_name: IOP
>>>   hpptdmgrsrvport: 
>>>
>>>
>>> I need a hash of above data as 
>>> Hash 1 : 
>>> esa-group-service:   
>>>   hgroup: websph
>>>   hdmgr_profile: TST
>>>   hdmgr_cell: CELL
>>>   hcluster_name: CLUSTER
>>>   hpptdmgrsrvport: 8080
>>>   hs3sourcepath: 'glic.binaries/websphere'
>>>   hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
>>>   hibmagentpath: 
>>> /opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
>>>   hbase_dir: '/opt/was/was855'
>>>   hinstance_name: WebSphere
>>>
>>> Hash 2
>>>   esa-user-profile-service:
>>>   hdmgr_profile: ABC
>>>   hdmgr_cell: PQS
>>>   hcluster_name: IOP
>>>   hpptdmgrsrvport: 
>>>   hs3sourcepath: 'glic.binaries/websphere'
>>>   hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
>>>   hibmagentpath: 
>>> /opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
>>>   hbase_dir: '/opt/was/was855'
>>>   hinstance_name: WebSphere
>>>
>>> So I trying to merge the has of esa-group-service to was_data and 
>>> esa-user-profile-service to was_data
>>>
>>> Please let me know if there is a way
>>>
>>

-- 
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/a7e5b925-2c85-4cb6-beaa-892ca1c1c80e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] Re: Hiera Merge

2017-08-09 Thread ggun
Thanks

On Tuesday, August 8, 2017 at 7:10:13 PM UTC-4, ggun wrote:
>
> Hi Experts,
>
> I have a requirement as below.
> I need to create a Hash from below hiera data.
>
> was_data:
>   hs3sourcepath: 'glic.binaries/websphere'
>   hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
>   hibmagentpath: 
> /opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
>   hbase_dir: '/opt/was/was855'
>   hinstance_name: WebSphere
>   was_dmgr_data:
> esa-group-service:  
>   hgroup: websph
>   hdmgr_profile: TST
>   hdmgr_cell: CELL
>   hcluster_name: CLUSTER
>   hpptdmgrsrvport: 8080
> esa-user-profile-service:
>   hdmgr_profile: ABC
>   hdmgr_cell: PQS
>   hcluster_name: IOP
>   hpptdmgrsrvport: 
>
>
> I need a hash of above data as 
> Hash 1 : 
> esa-group-service:   
>   hgroup: websph
>   hdmgr_profile: TST
>   hdmgr_cell: CELL
>   hcluster_name: CLUSTER
>   hpptdmgrsrvport: 8080
>   hs3sourcepath: 'glic.binaries/websphere'
>   hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
>   hibmagentpath: 
> /opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
>   hbase_dir: '/opt/was/was855'
>   hinstance_name: WebSphere
>
> Hash 2
>   esa-user-profile-service:
>   hdmgr_profile: ABC
>   hdmgr_cell: PQS
>   hcluster_name: IOP
>   hpptdmgrsrvport: 
>   hs3sourcepath: 'glic.binaries/websphere'
>   hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
>   hibmagentpath: 
> /opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
>   hbase_dir: '/opt/was/was855'
>   hinstance_name: WebSphere
>
> So I trying to merge the has of esa-group-service to was_data and 
> esa-user-profile-service to was_data
>
> Please let me know if there is a way
>

-- 
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/db787a3a-de76-43cc-840a-ed8905510aa0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] Hiera Merge

2017-08-08 Thread ggun
Hi Experts,

I have a requirement as below.
I need to create a Hash from below hiera data.

was_data:
  hs3sourcepath: 'glic.binaries/websphere'
  hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
  hibmagentpath: 
/opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
  hbase_dir: '/opt/was/was855'
  hinstance_name: WebSphere
  was_dmgr_data:
esa-group-service:  
  hgroup: websph
  hdmgr_profile: TST
  hdmgr_cell: CELL
  hcluster_name: CLUSTER
  hpptdmgrsrvport: 8080
esa-user-profile-service:
  hdmgr_profile: ABC
  hdmgr_cell: PQS
  hcluster_name: IOP
  hpptdmgrsrvport: 


I need a hash of above data as 
Hash 1 : 
esa-group-service:   
  hgroup: websph
  hdmgr_profile: TST
  hdmgr_cell: CELL
  hcluster_name: CLUSTER
  hpptdmgrsrvport: 8080
  hs3sourcepath: 'glic.binaries/websphere'
  hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
  hibmagentpath: 
/opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
  hbase_dir: '/opt/was/was855'
  hinstance_name: WebSphere

Hash 2
  esa-user-profile-service:
  hdmgr_profile: ABC
  hdmgr_cell: PQS
  hcluster_name: IOP
  hpptdmgrsrvport: 
  hs3sourcepath: 'glic.binaries/websphere'
  hdaresponse_file: /opt/software/WAS8.5.5.10_Install.xml
  hibmagentpath: 
/opt/software/agent.installer.linux.gtk.x86_64_1.8.2000.20150303_1526.zip
  hbase_dir: '/opt/was/was855'
  hinstance_name: WebSphere

So I trying to merge the has of esa-group-service to was_data and 
esa-user-profile-service to was_data

Please let me know if there is a way

-- 
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/9ee70d45-18e9-4e6f-87ed-78000ac47140%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] Puppet Console showing Error

2017-07-11 Thread ggun
hi ,

I was browsing the puppet console for one of the node and when I clicked on 
the reports tab I got the error message.
Error retrieving node reports: Unexpected end of JSON input
Has anyone encountered this issue before on the console? It has happened to 
just this node.
Current Puppet version is - v2016.4.2


-- 
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/946f9113-cc53-4439-9ba5-89f57b027160%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet-dev] Puppet command execution through ruby

2017-05-25 Thread ggun
I am developing the module on the agent and executing the module as puppet 
apply -e 'include xxx' -- so I am not using master and but still I am 
ending up with same issue.
I have restarted the server to make sure there is not caching that is 
causing this issue.

On Thursday, May 25, 2017 at 2:56:48 PM UTC-4, Richard Clamp wrote:
>
> It sounds like you're developing with a master.  If so you're going to 
> need to rerun the agent on that node and restart the master so that the 
> type is reloaded and the additional parameters are recognised. 
>
> Generally though you're better off developing with `puppet apply` so the 
> type code has a shorter lifespan. 
>
>
> > On 25 May 2017, at 19:52, ggun <gaurav...@gmail.com > 
> wrote: 
> > 
> > evelop
> > 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> 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 
> >> 
> >> 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 bel

Re: [Puppet-dev] Puppet command execution through ruby

2017-05-25 Thread ggun


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 > 
> 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]
>

Re: [Puppet-dev] Puppet command execution through ruby

2017-05-25 Thread ggun
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



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_source=footer>
> .
> For more options, visit https://groups.google.c

[Puppet-dev] Puppet command execution through ruby

2017-05-24 Thread ggun
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 puppet-dev+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet-dev] Puppet Provider and Type

2017-05-24 Thread ggun
Thank you for quick reply. 

On Wednesday, May 24, 2017 at 1:52:44 PM UTC-4, Nick Lewis wrote:
>
>
>
> On Wed, May 24, 2017 at 10:41 AM ggun <gaurav...@gmail.com > 
> wrote:
>
>> Writing puppet provider and type :
>> 1. I am trying to write my module with provider and type and every time I 
>> run the module. I get the error 'Error: Could not find a suitable provider 
>> ssm'
>>
>> Please find attached module. Every time I run 'puppet apply -e 'include 
>> storagemanagement' I get above error. I have written simple print commands 
>> in provider but still getting that error.
>>
>>
>>
> It looks like your provider probably has incorrect `confine` statements. 
> You have `confine :ssm => '/usr/bin/ssm'`, which will only match if there 
> is a fact called 'ssm' with the value '/usr/bin/ssm'. I think what you're 
> looking for is `commands :ssm => '/usr/bin/ssm'` (commands vs. confine), 
> which will restrict the provider to only nodes where that command exists. 
> It will also create a helper method called 'ssm' that will run that command.
>  
>
>>
>>
>>
>>
>> -- 
>> 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/9698eb69-d7d6-462e-840c-da2dfc375c87%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-dev/9698eb69-d7d6-462e-840c-da2dfc375c87%40googlegroups.com?utm_medium=email_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/ea491af8-51e7-475e-a4f8-09e43ecbd691%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] System storage management for RHEL 7 or above

2017-05-24 Thread ggun
Hi Experts,

Does anyone have puppet module for ssm (for file system or logical volume 
group management in RHEL 7 and above)?  I have seen module for LVM but 
nothing for RHEL 7 that uses ssm utility.

-- 
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/4c62ea49-8a55-4b91-8ffd-3aaae661f2f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet-dev] File Management using puppet

2017-05-24 Thread ggun
Thank you. David for immediate reply. Answer - ' I'd switch the title and 
target of the symlink around'

On Wednesday, May 24, 2017 at 10:44:33 AM UTC-4, David Schmitt wrote:
>
>
>
> On 24 May 2017 at 15:16, ggun <gaurav...@gmail.com > wrote:
>
>> Hi Experts,
>>
>> I need your help in below requirement.
>> *Requirement*
>> I need to create a file (xxx_logrotate.conf) with content as below 
>>
>> /xx/xx/xx.log {
>>
>>  weekly
>>
>>  copytruncate
>>
>>  rotate 8
>>
>>  compress
>>
>> maxage 180
>>
>> missingok
>>
>> }
>>
>>
>> 2. Create the symlink for above create file xxx_logrotate.conf to 
>> /etc/logrotate.d/xxx_logrotate.conf
>>
>>
>> *My approach*
>>
>>
>> 1. I went ahead creating the file with using erb tempalte for adding the 
>> file content but when I create a new resource to create the symlik for the 
>> source and target. The puppet run fails with duplicate file resource 
>>
>>
>>   file { 'xxx-log-rotation-config-file':
>>
>> ensure  => 'present',
>>
>> path=> '/xxx/conf/xxx_logrotate.conf',
>>
>> content => template('aaa/xxx_logrotate.conf.erb'),
>>
>> owner   => 'root',
>>
>> group   => 'root',
>>
>>   }
>>
>>
>>   file { '/xxx/conf/xxx_logrotate.conf':
>>
>> ensure  => 'link',
>>
>> target  => '/etc/logrotate.d/xxx_logrotate.conf',
>>
>> require => File['xxx-log-rotation-config-file'],
>>
>>   }
>>
>>
>> The puppet run fails for above code with below error 
>>
>> Error: Evaluation Error: Error while evaluating a Resource Statement, 
>> Duplicate declaration: File[/xxx/conf/mysql_logrotate.conf] is already 
>> declared in file 
>> /etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:46;
>>  
>> cannot redeclare at 
>> /etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:54
>>  
>> at 
>> /etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:54:3
>>  
>>
>>
>>
>>
> You need to decide where you want the file, and where you want the 
> symlink. As it stands, you define the file /xxx/conf/xxx_logrotate.conf 
> twice, once with the templated content, once as symlink. In your situation, 
> I'd switch the title and target of the symlink around.
>
>
> Cheers, David
>
>

-- 
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/99c6e5e0-505c-4f75-88ef-c2d15484b31d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet-dev] Need help installing .bin rpm file using puppet

2017-05-24 Thread ggun
FYI : McAfee Database Sensor comes as a rpm.bin

On Wednesday, May 24, 2017 at 10:04:49 AM UTC-4, ggun wrote:
>
> Thank you. I will extract and use the extracted rpm .
>
> On Wednesday, May 17, 2017 at 7:31:39 AM UTC-4, David Schmitt wrote:
>>
>> Hi Gaurav,
>>
>> what are rpm.bin files? I've never heard of that before.
>>
>> The first hit on google is a description of weird JDK packaging from 
>> Oracle, where rpm.bin files are actually self-extracting shell scripts to 
>> do their wretched license dance. If that is your use-case, I would run this 
>> manually once on a scratch machine, capture the extracted RPM and use that 
>> going forward.
>>
>>
>> Cheers, David
>>
>> On 10 May 2017 at 04:12, gaurav gundal <gaurav...@gmail.com> wrote:
>>
>>> Hi ,
>>>
>>> I am trying to manage the rpm.bin using puppet. I want to install the 
>>> x.rpm.bin on the RHEL 7 using puppet, but puppet package cannot be used to 
>>> install the .bin package directly.
>>> I have the file local on the server and I don't want to use and exec 
>>> puppet resource to unpack bin and then use package.
>>> Is there any module to unpack the bin file so that I can then use the 
>>> unpacked bin rpm as a pacakge.
>>>
>>> Thank you!
>>>
>>> -- 
>>> 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/fe267403-2f1c-4d8a-b0e9-7bbbc406bd5c%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/puppet-dev/fe267403-2f1c-4d8a-b0e9-7bbbc406bd5c%40googlegroups.com?utm_medium=email_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/2a3ae420-ff5f-4ed6-9fea-b6d0220181e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet-dev] File Management using puppet

2017-05-24 Thread ggun
Hi Experts,

I need your help in below requirement.
*Requirement*
I need to create a file (xxx_logrotate.conf) with content as below 

/xx/xx/xx.log {

 weekly

 copytruncate

 rotate 8

 compress

maxage 180

missingok

}


2. Create the symlink for above create file xxx_logrotate.conf to 
/etc/logrotate.d/xxx_logrotate.conf


*My approach*


1. I went ahead creating the file with using erb tempalte for adding the 
file content but when I create a new resource to create the symlik for the 
source and target. The puppet run fails with duplicate file resource 


  file { 'xxx-log-rotation-config-file':

ensure  => 'present',

path=> '/xxx/conf/xxx_logrotate.conf',

content => template('aaa/xxx_logrotate.conf.erb'),

owner   => 'root',

group   => 'root',

  }


  file { '/xxx/conf/xxx_logrotate.conf':

ensure  => 'link',

target  => '/etc/logrotate.d/xxx_logrotate.conf',

require => File['xxx-log-rotation-config-file'],

  }


The puppet run fails for above code with below error 

Error: Evaluation Error: Error while evaluating a Resource Statement, 
Duplicate declaration: File[/xxx/conf/mysql_logrotate.conf] is already 
declared in file 
/etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:46;
 
cannot redeclare at 
/etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:54
 
at 
/etc/puppetlabs/code/environments/production/modules/xxx/manifests/postinstall.pp:54:3
 



Is there a better way of handling this without any issue using file 
resource?

-- 
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/9108c3b2-0a1f-4126-a5d1-432a70240896%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet-dev] Need help installing .bin rpm file using puppet

2017-05-24 Thread ggun
Thank you. I will extract and use the extracted rpm .

On Wednesday, May 17, 2017 at 7:31:39 AM UTC-4, David Schmitt wrote:
>
> Hi Gaurav,
>
> what are rpm.bin files? I've never heard of that before.
>
> The first hit on google is a description of weird JDK packaging from 
> Oracle, where rpm.bin files are actually self-extracting shell scripts to 
> do their wretched license dance. If that is your use-case, I would run this 
> manually once on a scratch machine, capture the extracted RPM and use that 
> going forward.
>
>
> Cheers, David
>
> On 10 May 2017 at 04:12, gaurav gundal  
> wrote:
>
>> Hi ,
>>
>> I am trying to manage the rpm.bin using puppet. I want to install the 
>> x.rpm.bin on the RHEL 7 using puppet, but puppet package cannot be used to 
>> install the .bin package directly.
>> I have the file local on the server and I don't want to use and exec 
>> puppet resource to unpack bin and then use package.
>> Is there any module to unpack the bin file so that I can then use the 
>> unpacked bin rpm as a pacakge.
>>
>> Thank you!
>>
>> -- 
>> 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/fe267403-2f1c-4d8a-b0e9-7bbbc406bd5c%40googlegroups.com
>>  
>> 
>> .
>> 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/5e5116e9-93fa-4cef-ac80-165e0ca4f531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.