Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Liu, Xiaopeng (133) <[email protected]>
  • Loading branch information
Liu, Xiaopeng (133) committed May 13, 2020
1 parent fc45b9e commit ec70b9a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 5 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# Changelog

## [0.1.1][]
## [0.1.2][]

### Changed

- Bugfix: kill process now passes correct parameter
- Refactory: abstract core workflow into one common function to reduce duplicates

### Added
- Refactory: [Issue #4](https://github.com/chaostoolkit-incubator/chaostoolkit-saltstack/issues/4) Salt API accepts eauth method as parameter in configuration

- Network experiments now accepts device name to adapt different os
- Add experiment action of kill processes by name
- Add experiment action of kill process by PID
- Add experiment probe to check process PID by name
## [0.1.1][]

### Changed

- Bugfix: kill process now passes correct parameter
- Refactory: abstract core workflow into one common function to reduce duplicates

### Added

- Network experiments now accepts device name to adapt different os
- Add experiment action of kill processes by name
- Add experiment action of kill process by PID
- Add experiment probe to check process PID by name
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ There are two ways of doing this:
```

* or you inject the secrets explicitly to the experiment definition:
SALTMASTER_EAUTH is optional and default to pam

```json
{
"saltstack": {
"SALTMASTER_HOST": "https://172.10.20.666",
"SALTMASTER_USER": "username",
"SALTMASTER_PASSWORD": "password"
"SALTMASTER_EAUTH": "sharedsecret"
}
}
```
Expand Down
7 changes: 5 additions & 2 deletions chaossaltstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ def __init__(self, configuration):
elif 'username' in configuration:
self.username = configuration['username']
self.password = configuration['password']
self.eauth = configuration['eauth']
# Default settings for Salt Master
self.headers = {"Content-type": "application/json"}
self.params = {'client': 'local', 'fun': '', 'tgt': ''}
# Use User/Pass
self.login_url = self.url + "/login"
self.login_params = {
'username': self.username, 'password': self.password,
'eauth': 'pam'
'eauth': self.eauth
}

def run_cmd(self, tgt, method: str, arg=None):
Expand Down Expand Up @@ -164,9 +165,10 @@ def saltstack_api_client(secrets: Secrets = None) -> salt_api_client:
* SALTMASTER_HOST: Salt Master API address
You can authenticate with user / password via:
You can authenticate with user / password / eauth via:
* SALTMASTER_USER: the user name
* SALTMASTER_PASSWORD: the password
* SALTMASTER_EAUTH: the auth method, default to pam
Or via a token:
* SALTMASTER_TOKEN
Expand Down Expand Up @@ -197,6 +199,7 @@ def lookup(k: str, d: str = None) -> str:
if "SALTMASTER_USER" in env or "SALTMASTER_USER" in secrets:
configuration['username'] = lookup("SALTMASTER_USER", "")
configuration['password'] = lookup("SALTMASTER_PASSWORD", "")
configuration['eauth'] = lookup("SALTMASTER_EAUTH", "pam")
elif "SALTMASTER_TOKEN" in env or "SALTMASTER_TOKEN" in secrets:
configuration['token'] = lookup("SALTMASTER_TOKEN")
else:
Expand Down
3 changes: 1 addition & 2 deletions chaossaltstack/machine/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def network_loss(instance_ids: List[str] = None,
param["duration"] = execution_duration
param["param"] = "loss " + loss_ratio
param["device"] = device

return __default_salt_experiment__(instance_ids=instance_ids,
execution_duration=execution_duration,
param=param,
Expand Down Expand Up @@ -253,7 +253,6 @@ def network_corruption(instance_ids: List[str] = None,
param["param"] = "corrupt " + corruption_ratio
param["device"] = device


return __default_salt_experiment__(instance_ids=instance_ids,
execution_duration=execution_duration,
param=param,
Expand Down

0 comments on commit ec70b9a

Please sign in to comment.