forked from poppy-project/puppet-master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.py
32 lines (23 loc) · 1.17 KB
/
bootstrap.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
import os
import argparse
from string import Template
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Deploy script for puppet master',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('hostname', type=str, help='Hostname of the machine used')
parser.add_argument('creature', type=str, help='Creature used')
parser.add_argument('--board', type=str, help='Board used', default='Raspberry Pi')
parser.add_argument('--branch', type=str, help='Git branch to update', default='master')
parser.add_argument('--config-path', type=str,
default=os.path.expanduser('~/.poppy_config.yaml'),
help='Path to deploy the config file.')
args = parser.parse_args()
# Install config from default template
with open('default_config.yaml') as f:
s = Template(f.read())
s = s.substitute(name=args.hostname, creature=args.creature,
home=os.path.expanduser('~'),
board=args.board,
branch=args.branch)
with open(args.config_path, 'w') as f:
f.write(s)