Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Add support to SSH common args, make SSH config optional (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankrnr32 committed Nov 25, 2021
1 parent aa8815c commit 848baae
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/ychaos/testplan/attack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2021, Yahoo
# Licensed under the terms of the Apache 2.0 license. See the LICENSE file in the project root for terms
import getpass
import os
import re
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -35,6 +36,15 @@ class SSHConfig(SchemaModel):
default=None,
description="The password that will be used to login to the hosts.",
)
ssh_common_args: str = Field(
default=os.getenv("ANSIBLE_SSH_COMMON_ARGS", ""),
description="The common Arguments to be used while SSHing to a host with Ansible (`$ANSIBLE_SSH_COMMON_ARGS`)",
)

@validator("ssh_common_args", always=True)
def set_ssh_common_args_env(cls, v):
os.environ["ANSIBLE_SSH_COMMON_ARGS"] = v
return v


class MachineTargetDefinition(TargetDefinition):
Expand Down Expand Up @@ -65,7 +75,8 @@ class MachineTargetDefinition(TargetDefinition):
)

ssh_config: SSHConfig = Field(
..., description="The configuration used to SSH to the target machines."
default=SSHConfig(),
description="The configuration used to SSH to the target machines.",
)

hostnames: List[FQDN] = Field(
Expand Down

0 comments on commit 848baae

Please sign in to comment.