Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@salt-master pillar]# cat base/ssh.sls
- #!yamlex
- ssh: !aggregate
- keys: !aggregate
- - one: b
- two: a
- [root@salt-master pillar]# cat group/ssh.sls
- #!yamlex
- !reset ssh: !aggregate
- !reset keys: !aggregate
- - three: a
- four: b
- [root@salt-master pillar]# cat base/top.sls
- base:
- '*':
- - ssh
- group:
- '*':
- - ssh
- [root@salt-master pillar]# salt 'qa-server*' pillar.items
- qa-server:
- ----------
- ssh:
- ----------
- keys:
- |_
- ----------
- four:
- b
- three:
- a
- |_
- ----------
- one:
- b
- two:
- a
- [root@salt-master pillar]# cat test.py
- #!/usr/bin/python
- from salt.utils.serializers.yamlex import serialize, deserialize
- parseme = '''
- ssh: !aggregate
- keys: !aggregate
- - one: b
- two: a
- !reset ssh: !aggregate
- !reset keys: !aggregate
- - three: a
- four: b
- '''
- print deserialize(parseme)
- [root@salt-master pillar]# python test.py
- {ssh: {keys: [{three: a, four: b}]}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement