-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
executable file
·47 lines (42 loc) · 1.14 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
from linker import *
import json
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
_pillar_ = {
'logdir': '/var/log/myapp',
'tomcat': {
'port': 8080
},
'apache': {
'modjk': {
'ajp': '__PILLAR_LINK__ tomcat:port',
'abc': {
'def': '__PILLAR_LINK__ logdir'
},
'123': {
'another_key': '__PILLAR_LINK__ apache:modjk:abc:def'
}
}
},
'mysql.port': '__PILLAR_LINK__ db:port'
}
if __name__ == '__main__':
graph = Graph(flag='__PILLAR_LINK__')
graph.create(_pillar_)
graph.topsort()
print '--------------'
print '--- PILLAR ---'
print '--------------'
print json.dumps(_pillar_, indent=4, sort_keys=True)
print '--------------------'
print '--- Sorted Graph ---'
print '--------------------'
print graph.sorted
print '--------------'
print '--- Result ---'
print '--------------'
print json.dumps(
salt.utils.dictupdate.update(_pillar_, ext_pillar(None, _pillar_)),
indent=4, sort_keys=True
)