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: 0000
>>>
>>>
>>> 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: 0000
>>>       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.

Reply via email to