Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P8287
Puppet DTRT
Active
Public
Actions
Authored by
Joe
on Mar 27 2019, 11:37 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F28482597: raw.txt
Mar 27 2019, 11:37 AM
2019-03-27 11:37:49 (UTC+0)
Subscribers
None
$data = {
'bar' => {
'regr' => 'BAR',
'directory' => "BARDIR"
},
'foo' => {
'regr' => 'FOO',
'directory' => "FOODIR",
'default' => 'true',
},
}
$accounts = $data.map |String $account, Hash[String, String] $account_details| {
$ret = {
id => $account,
directory => $account_details['directory'],
}
if has_key($account_details, 'default') {
merge($ret, { 'default' => $account_details['default'] })
} else {
$ret
}
}
notice($accounts)
---
$ puppet apply --modulepath=Code/WMF/operations/puppet/modules prova.pp
Notice: Scope(Class[main]): [{id => bar, directory => BARDIR}, {id => foo, directory => FOODIR, default => true}]
Event Timeline
Joe
created this paste.
Mar 27 2019, 11:37 AM
2019-03-27 11:37:49 (UTC+0)
Log In to Comment