I am trying to return the UUID for a given partition. This is the closest I can get, but you can see it returns everything in `$::partitions`, and then appends "[sda1][uuid]" at the end as if it's concatenating a string part.
puppet apply -e 'notify { "$::partitions['sda1']['uuid']": }'
Notice: Compiled catalog for aaron in environment production in 0.05 seconds
Notice: sda1labelbootmount/bootfilesystemext4size1024000uuid3abd6b4e-d17e-4c03-bd64-8df6827c79bbsda2filesystemLVM2_membersize936675328[sda1][uuid]
Notice: /Stage[main]/Main/Notify[sda1labelbootmount/bootfilesystemext4size1024000uuid3abd6b4e-d17e-4c03-bd64-8df6827c79bbsda2filesystemLVM2_membersize936675328[sda1][uuid]]/message: defined 'message' as 'sda1labelbootmount/bootfilesystemext4size1024000uuid3abd6b4e-d17e-4c03-bd64-8df6827c79bbsda2filesystemLVM2_membersize936675328[sda1][uuid]'
Notice: Finished catalog run in 0.03 seconds
So, I try wrapping the hash in brackets without quotes;
puppet apply -e 'notify { ${::partitions['sda1']['uuid']}: }'
Error: Could not parse for environment production: Could not match ${::partitions[sda1][uuid]}: at line 1 on node aaron
Error: Could not parse for environment production: Could not match ${::partitions[sda1][uuid]}: at line 1 on node aaron
And then with quotes;
puppet apply -e 'notify { "${::partitions['sda1']['uuid']}": }'
Error: ::partitions is not a hash or array when accessing it with sda1 at line 1 on node aaron
Error: ::partitions is not a hash or array when accessing it with sda1 at line 1 on node aaron
I have referenced the following question/answer on this site and am still having trouble.
https://ask.puppetlabs.com/question/17315/howto-retrieve-deep-structured-facter-fact/
↧