Commit eae52feb by Feanil Patel

Be able to turn off strict host checking.

parent f9016a15
"""VPC Tools.
Usage:
vpc-tools.py ssh-config vpc <vpc_id> identity-file <identity_file> user <user> [config-file <config_file>]
vpc-tools.py ssh-config vpc <vpc_id> identity-file <identity_file> user <user> [config-file <config_file>] [strict-host-check <strict_host_check>]
vpc-tools.py (-h --help)
vpc-tools.py (-v --version)
......@@ -16,6 +16,7 @@ from docopt import docopt
VERSION="vpc tools 0.1"
DEFAULT_USER="ubuntu"
DEFAULT_HOST_CHECK="yes"
JUMPBOX_CONFIG = """
Host {jump_box}
......@@ -23,6 +24,7 @@ JUMPBOX_CONFIG = """
IdentityFile {identity_file}
ForwardAgent yes
User {user}
StrictHostKeyChecking {strict_host_check}
"""
HOST_CONFIG = """
......@@ -32,6 +34,7 @@ HOST_CONFIG = """
IdentityFile {identity_file}
ForwardAgent yes
User {user}
StrictHostKeyChecking {strict_host_check}
"""
......@@ -48,10 +51,14 @@ def _ssh_config(args):
user = args.get("<user>")
vpc_id = args.get("<vpc_id>")
config_file = args.get("<config_file>")
strict_host_check = args.get("<strict_host_check>")
if not user:
user = DEFAULT_USER
if not strict_host_check:
strict_host_check = DEFAULT_HOST_CHECK
if config_file:
config_file = "-F {}".format(config_file)
else:
......@@ -73,7 +80,8 @@ def _ssh_config(args):
jump_box=jump_box,
ip=instance.ip_address,
user=user,
identity_file=identity_file)
identity_file=identity_file,
strict_host_check=strict_host_check)
else:
print HOST_CONFIG.format(
......@@ -84,7 +92,8 @@ def _ssh_config(args):
user=user,
logical_id=logical_id,
identity_file=identity_file,
config_file=config_file)
config_file=config_file,
strict_host_check=strict_host_check)
#duplicating for convenience with ansible
name = friendly.format(vpc_id=vpc_id,
......@@ -98,7 +107,8 @@ def _ssh_config(args):
user=user,
logical_id=logical_id,
identity_file=identity_file,
config_file=config_file)
config_file=config_file,
strict_host_check=strict_host_check)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment