Skip to content

Commit

Permalink
formating
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed May 14, 2024
1 parent f05bfda commit 762bb3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions fabric_am/handlers/switch_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def create(self, unit: ConfigToken) -> Tuple[dict, ConfigToken]:
ansible_ssh_user = host.get_vars().get('ansible_ssh_user')
ansible_ssh_pwd = host.get_vars().get('ansible_ssh_pwd')

print(f"KOMAL ---- {host.get_vars()}")
print(f"KOMAL --- {ansible_ssh_pwd}")

Utils.verify_ssh(mgmt_ip=ansible_host, user=ansible_ssh_user, pwd=ansible_ssh_pwd,
logger=self.get_logger(), retry=10)
extra_vars = {
Expand Down
4 changes: 2 additions & 2 deletions fabric_am/util/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def execute_command(*, mgmt_ip: str, user: str, command: str, logger: logging.Lo
# Construct the SSH client
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
if pwd:
if pwd is not None:
# Use password for authentication
ssh.connect(mgmt_ip, username=user, password=pwd, timeout=timeout)
else:
Expand Down Expand Up @@ -298,7 +298,7 @@ def verify_ssh(*, mgmt_ip: str, user: str, logger: logging.Logger, timeout: int

try:
output = Utils.execute_command(mgmt_ip=mgmt_ip, user=user, command=command, logger=logger,
timeout=timeout, retry=retry, pwd=pwd, ssh_key_file=ssh_key_file)
timeout=timeout, retry=retry, pwd=pwd, ssh_key_file=ssh_key_file)
logger.info(f"Output: {output}")
except Exception as e:
pass
Expand Down

0 comments on commit 762bb3d

Please sign in to comment.