Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tpl = "dladm create-{{{type}}} {{{sets}}} {{{cmd}}}"
- key = yaml.keys.first
- tpl.gsub! '{{{type}}}', yaml[key]['type']
- tpl.gsub! '{{{cmd}}}', key
- sets = ''
- set_tpl = '-l {{{key}}} -L={{{mode}}} -P={{{policy}}} '
- yaml[key]['device'].each do |device|
- set = set_tpl.dup
- set.gsub! '{{{key}}}', device[0]
- set.gsub! '{{{mode}}}', device[1]['mode']
- set.gsub! '{{{policy}}}', device[1]['policy'].join(',')
- sets << set
- end
- tpl.gsub! '{{{sets}}}', sets
- puts tpl.gsub(/\s+/,' ')
Add Comment
Please, Sign In to add comment