Executors
Runner
Bases: Base
Source code in atomic_operator/execution/runner.py
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 |
|
clean_output(data)
Decodes data and strips CLI garbage from returned outputs and errors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
str
|
A output or error returned from subprocess |
required |
Returns:
Name | Type | Description |
---|---|---|
str | A cleaned string which will be displayed on the console and in logs |
Source code in atomic_operator/execution/runner.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
execute(host_name='localhost', executor=None, host=None)
The main method which runs a single AtomicTest object on a local system.
Source code in atomic_operator/execution/runner.py
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 |
|
print_process_output(command, return_code, output, errors)
Outputs the appropriate outputs if they exists to the console and log files
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
str
|
The command which was ran by subprocess |
required |
return_code |
int
|
The return code from subprocess |
required |
output |
bytes
|
Output from subprocess which is typically in bytes |
required |
errors |
bytes
|
Errors from subprocess which is typically in bytes |
required |
Source code in atomic_operator/execution/runner.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
LocalRunner
Bases: Runner
Runs AtomicTest objects locally
Source code in atomic_operator/execution/localrunner.py
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 |
|
__init__(atomic_test, test_path)
A single AtomicTest object is provided and ran on the local system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_test |
AtomicTest
|
A single AtomicTest object. |
required |
test_path |
Atomic
|
A path where the AtomicTest object resides |
required |
Source code in atomic_operator/execution/localrunner.py
10 11 12 13 14 15 16 17 18 19 |
|
execute_process(command, executor=None, host=None, cwd=None, elevation_required=False)
Executes commands using subprocess
Parameters:
Name | Type | Description | Default |
---|---|---|---|
executor |
str
|
An executor or shell used to execute the provided command(s) |
None
|
command |
str
|
The commands to run using subprocess |
required |
cwd |
str
|
A string which indicates the current working directory to run the command |
None
|
elevation_required |
bool
|
Whether or not elevation is required |
False
|
Returns:
Name | Type | Description |
---|---|---|
tuple | A tuple of either outputs or errors from subprocess |
Source code in atomic_operator/execution/localrunner.py
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 |
|
RemoteRunner
Bases: Runner
Source code in atomic_operator/execution/remoterunner.py
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 |
|
__init__(atomic_test, test_path)
A single AtomicTest object is provided and ran on the local system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_test |
AtomicTest
|
A single AtomicTest object. |
required |
test_path |
Atomic
|
A path where the AtomicTest object resides |
required |
Source code in atomic_operator/execution/remoterunner.py
19 20 21 22 23 24 25 26 27 |
|
execute_process(command, executor=None, host=None, cwd=None, elevation_required=False)
Main method to execute commands using state machine
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
str
|
The command to run remotely on the desired systems |
required |
executor |
str
|
An executor that can be passed to state machine. Defaults to None. |
None
|
host |
str
|
A host to run remote commands on. Defaults to None. |
None
|
Source code in atomic_operator/execution/remoterunner.py
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 |
|
start(host=None, executor=None)
The main method which runs a single AtomicTest object remotely on one remote host.
Source code in atomic_operator/execution/remoterunner.py
100 101 102 103 |
|
AWSRunner
Bases: ExecutionBase
Runs AtomicTest objects against AWS using the aws-cli
Source code in atomic_operator/execution/awsrunner.py
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 |
|
__init__(atomic_test, test_path)
A single AtomicTest object is provided and ran using the aws-cli
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atomic_test |
AtomicTest
|
A single AtomicTest object. |
required |
test_path |
Atomic
|
A path where the AtomicTest object resides |
required |
Source code in atomic_operator/execution/awsrunner.py
10 11 12 13 14 15 16 17 18 19 |
|
execute_process(command, executor=None, host=None, cwd=None, elevation_required=False)
Executes commands using subprocess
Parameters:
Name | Type | Description | Default |
---|---|---|---|
executor |
str
|
An executor or shell used to execute the provided command(s) |
None
|
command |
str
|
The commands to run using subprocess |
required |
cwd |
str
|
A string which indicates the current working directory to run the command |
None
|
elevation_required |
bool
|
Whether or not elevation is required |
False
|
Returns:
Name | Type | Description |
---|---|---|
tuple | A tuple of either outputs or errors from subprocess |
Source code in atomic_operator/execution/awsrunner.py
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 |
|
CreationState
Bases: State
The state which is used to modify commands
Source code in atomic_operator/execution/statemachine.py
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 |
|
InnvocationState
Bases: State
, Base
The state which indicates the invocation of a command
Source code in atomic_operator/execution/statemachine.py
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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
ParseResultsState
The state which is used to parse the results
Source code in atomic_operator/execution/statemachine.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
State
We define a state object which provides some utility functions for the individual states within the state machine.
Source code in atomic_operator/execution/statemachine.py
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 |
|
on_event(event)
Handle events that are delegated to this State.
Source code in atomic_operator/execution/statemachine.py
43 44 45 46 47 |
|