-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Expand file tree
/
Copy pathscripts.py
More file actions
137 lines (115 loc) · 2.71 KB
/
Copy pathscripts.py
File metadata and controls
137 lines (115 loc) · 2.71 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# -*- coding: utf-8 -*-
'''
This module contains the function calls to execute command line scipts
'''
# Import python libs
import os
import sys
# Import salt libs
import salt
import salt.cli
try:
import salt.cloud.cli
except ImportError:
# No salt cloud on Windows
pass
def salt_master():
'''
Start the salt-master.
'''
master = salt.Master()
master.start()
def salt_minion():
'''
Kick off a salt minion daemon.
'''
if '' in sys.path:
sys.path.remove('')
minion = salt.Minion()
minion.start()
def salt_syndic():
'''
Kick off a salt syndic daemon.
'''
pid = os.getpid()
try:
syndic = salt.Syndic()
syndic.start()
except KeyboardInterrupt:
os.kill(pid, 15)
def salt_key():
'''
Manage the authentication keys with salt-key.
'''
try:
saltkey = salt.cli.SaltKey()
saltkey.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_cp():
'''
Publish commands to the salt system from the command line on the
master.
'''
try:
cp_ = salt.cli.SaltCP()
cp_.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_call():
'''
Directly call a salt command in the modules, does not require a running
salt minion to run.
'''
if '' in sys.path:
sys.path.remove('')
try:
client = salt.cli.SaltCall()
client.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_run():
'''
Execute a salt convenience routine.
'''
if '' in sys.path:
sys.path.remove('')
try:
client = salt.cli.SaltRun()
client.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_ssh():
'''
Execute the salt-ssh system
'''
if '' in sys.path:
sys.path.remove('')
try:
client = salt.cli.SaltSSH()
client.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_cloud():
'''
The main function for salt-cloud
'''
if '' in sys.path:
sys.path.remove('')
try:
cloud = salt.cloud.cli.SaltCloud()
cloud.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')
def salt_main():
'''
Publish commands to the salt system from the command line on the
master.
'''
if '' in sys.path:
sys.path.remove('')
try:
client = salt.cli.SaltCMD()
client.run()
except KeyboardInterrupt:
raise SystemExit('\nExiting gracefully on Ctrl-c')