forked from freifunk-mwu/backend-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_ssh_all.py
executable file
·36 lines (30 loc) · 1.06 KB
/
deploy_ssh_all.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
#!/usr/bin/env python3
if __name__ == '__main__':
from common import pinit
from argparse import ArgumentParser
argp = ArgumentParser(prog='deploy_ssh')
photon, settings = pinit('deploy_ssh', verbose=True)
# initialize the gateway-configs repo ...
photon.git_handler(
settings['configs']['local'],
remote_url=settings['configs']['remote']
)
# .. to load contents from the ssh.yaml into the settings
if not photon.settings.load('ssh_deploy', settings['configs']['ssh_deploy']):
photon.m(
'could not load ssh_deploy',
more=dict(
ssh_deploy=settings['configs']['ssh_deploy']
),
state=True
)
photon.s2m
argp.add_argument(
'mtype',
action='store',
choices=settings['ssh_deploy'].keys()
)
argp = argp.parse_args()
for key in settings['ssh_deploy'][argp.mtype]:
conf_t = photon.template_handler('%s\n' %(settings['ssh_deploy'][argp.mtype][key]))
conf_t.write(settings['crypt']['ssh']['authorized'])