diff --git a/CHANGELOG.md b/CHANGELOG.md index a7587ca..91d00b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 1871592..afbb15c 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ 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 { @@ -127,6 +128,7 @@ There are two ways of doing this: "SALTMASTER_HOST": "https://172.10.20.666", "SALTMASTER_USER": "username", "SALTMASTER_PASSWORD": "password" + "SALTMASTER_EAUTH": "sharedsecret" } } ``` diff --git a/chaossaltstack/__init__.py b/chaossaltstack/__init__.py index 57e9fa7..5fa8566 100644 --- a/chaossaltstack/__init__.py +++ b/chaossaltstack/__init__.py @@ -33,6 +33,7 @@ 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': ''} @@ -40,7 +41,7 @@ def __init__(self, configuration): 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): @@ -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 @@ -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: diff --git a/chaossaltstack/machine/actions.py b/chaossaltstack/machine/actions.py index ea48467..f4ae5a8 100644 --- a/chaossaltstack/machine/actions.py +++ b/chaossaltstack/machine/actions.py @@ -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, @@ -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,