11.1.1
by Alex Kavanagh
Add get_charms and sync_charmhelpers useful scripts |
1 |
# Sync the charmhelpers accross all the charms that we have
|
2 |
# Note that this only works if there is a charm-helpers-hooks.yaml in the
|
|
3 |
# directory
|
|
4 |
||
5 |
import os |
|
6 |
import subprocess |
|
7 |
import sys |
|
8 |
||
9 |
CHARM_PREFIX = "./charms/" |
|
10 |
||
11 |
||
12 |
def sync_charms(): |
|
13 |
top_level_dirs = sorted(os.walk(CHARM_PREFIX).next()[1]) |
|
14 |
for d in top_level_dirs: |
|
15 |
p = os.path.join(".", "charms", d) |
|
16 |
f = os.path.join(p, "charm-helpers-hooks.yaml") |
|
17 |
if os.path.isfile(os.path.join(f)): |
|
18 |
cmd = "make sync".format(p) |
|
19 |
print(cmd) |
|
20 |
subprocess.check_call(cmd.split(" "), cwd=p) |
|
21 |
||
22 |
||
23 |
def main(argv): |
|
24 |
sync_charms() |
|
25 |
||
26 |
||
27 |
if __name__ == '__main__': |
|
28 |
main(sys.argv) |