3 from __future__
import print_function
8 COLOR_PURPLE =
'\033[95m' 9 COLOR_BLUE =
'\033[94m' 10 COLOR_GREEN =
'\033[92m' 11 COLOR_YELLOW =
'\033[93m' 12 COLOR_RED =
'\033[91m' 20 return 'sudo rpm --install {0}'.
format(rpm_path)
23 return 'sudo rpm -Uhv --force {0}'.
format(rpm_path)
26 machines = {
'bu' : [
'dqm-c2d07-22',
'bu-c2f13-31-01',
'bu-c2f13-29-01'],
27 'dev' : [
'dqm-c2d07-21',
'dqm-c2d07-22',
'dqm-c2d07-23',
'dqm-c2d07-24',
'dqm-c2d07-25',
'dqm-c2d07-26',
'dqm-c2d07-27'],
28 'dev_current' : [
'dqm-c2d07-22',
'dqm-c2d07-23'],
29 'ed' : [
'bu-c2f13-29-01',
'fu-c2f13-41-01',
'fu-c2f13-41-02',
'fu-c2f13-41-03',
'fu-c2f13-41-04'],
30 'ed_current' : [
'bu-c2f13-29-01',
'fu-c2f13-41-03'],
31 'prod' : [
'bu-c2f13-31-01',
'fu-c2f13-39-01',
'fu-c2f13-39-02',
'fu-c2f13-39-03',
'fu-c2f13-39-04'],
32 'prod_current' : [
'bu-c2f13-31-01',
'fu-c2f13-39-04']
36 actions = {
'rpm_install' : rpm_install,
37 'rpm_update' : rpm_update,
38 'rpm_install_status' :
'rpm -qa hltd',
39 'rpm_remove' :
'sudo rpm --erase hltd',
40 'daemon_status' :
'sudo /sbin/service hltd status',
41 'daemon_start' :
'sudo /sbin/service hltd start',
42 'daemon_stop' :
'sudo /sbin/service hltd stop',
43 'daemon_stop-light' :
'sudo /sbin/service hltd stop-light',
44 'daemon_restart' :
'sudo /sbin/service hltd restart'}
48 print(
'Usage: ' + sys.argv[0] +
' MACHINES ACTIONS')
51 for target
in machines.keys():
52 print(
'\t\t' + target +
': ' +
', '.
join(machines[target]))
55 for action
in actions.keys():
56 print(
'\t\t' + action)
61 print(COLOR_BLUE +
'***************************** ' + info +
' *****************************' + COLOR_DEF)
63 print(COLOR_BLUE +
'*********************************************************************************' + COLOR_DEF)
67 info(
'Machine: ' + machine)
69 call_list.append(
'ssh')
70 call_list.append(machine)
72 if hasattr(action,
'__call__'):
73 call_list.append(
action(machine))
75 call_list.append(action)
78 subprocess.call(call_list, stderr=subprocess.STDOUT)
83 if __name__ ==
'__main__':
88 targets = machines.get(sys.argv[1])
90 print(
'Wrong target machines')
93 action = actions.get(sys.argv[2])
98 for target
in targets:
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
def exec_func(machine, action)
static std::string join(char **cmd)