clearer names for actions, and infer actions better
[monitor.git] / histlog / add_conf_files.py
1 #!/usr/bin/plcsh 
2
3 # Setup file to be read by bash on startup
4 c = {'file_owner': 'root', 
5         'dest': '/usr/lib/snoopy.so',
6         'enabled': True, 
7         'file_permissions': '755',
8         'source':'PlanetLabConf/histlog/snoopy_so', 
9         'always_update': False,
10         'file_group': 'root'}
11
12 c2 = {'file_owner': 'root', 
13         'dest': '/etc/profile.d/histlog_snoopy.sh',
14         'enabled': True, 
15         'file_permissions': '644',
16         'source':'PlanetLabConf/histlog/histlog_snoopy_sh', 
17         'always_update': False,
18         'file_group': 'root'}
19
20 h = 'planetlab1.cs.stevens-tech.edu'
21
22 i = AddConfFile(c)
23 if h: 
24     AddConfFileToNode(i, h)
25 i = AddConfFile(c2)
26 if h: 
27     AddConfFileToNode(i, h)
28
29 # This does not cover nodes in FAILBOOT.  The above commands should also be
30 # added to BootManager so that commands taken by admins are uploaded before
31 # exec.
32
33 c3 = {'file_owner': 'root', 
34         'dest': '/etc/cron.d/upload_snoopylog.cron', 
35         'enabled': True,
36         'file_permissions': '644', 
37         'source': 'PlanetLabConf/histlog/upload.cron.php', 
38         'always_update': False,
39         'file_group': 'root'}
40
41 c4 = {'file_owner': 'root', 
42         'dest': '/usr/bin/collect_log.sh', 
43         'enabled': True,
44         'file_permissions': '750', 
45         'source': 'PlanetLabConf/histlog/collect_log_sh', 
46         'always_update': False,
47         'file_group': 'root'}
48
49 # NOTE: requires sshd_config option: PermitUserEnvironment=yes
50 c5 = {'file_owner': 'root', 
51         'dest': '/root/.ssh/environment', 
52         'enabled': True,
53         'file_permissions': '644', 
54         'source': 'PlanetLabConf/histlog/environment', 
55         'always_update': False,
56         'file_group': 'root'}
57
58 i = AddConfFile(c3)
59 if h: 
60     AddConfFileToNode(i, h)
61
62 i = AddConfFile(c4)
63 if h: 
64     AddConfFileToNode(i, h)
65
66 i = AddConfFile(c5)
67 if h: 
68     AddConfFileToNode(i, h)
69
70
71 for i in [84, 85, 86]:
72     UpdateConfFile(i, {'enabled': False})
73