Skip to content
This repository has been archived by the owner. It is now read-only.

Commit ffc8973

Browse files
Merge pull request #105 from zalando-stups/odd
Add option to disable odd per account
2 parents 85fa405 + 7d58b03 commit ffc8973

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sevenseconds/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from .config.configure import start_configuration, start_cleanup
1515

1616
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
17-
SUPPORTED_CONFIG_VERSION = 6
17+
SUPPORTED_CONFIG_VERSION = 7
1818

1919

2020
def print_version(ctx, param, value):

sevenseconds/config/bastion.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def configure_bastion_host(account: AccountData, vpc: object, region: str, base_
1919
cf = account.session.resource('cloudformation', region)
2020
cfc = account.session.client('cloudformation', region)
2121

22+
enable_bastion = account.config.get("enable_odd", True)
2223
re_deploy = account.config['bastion'].get('re_deploy', account.options.get('redeploy_odd_host'))
2324

2425
bastion_version = None
@@ -91,6 +92,10 @@ def configure_bastion_host(account: AccountData, vpc: object, region: str, base_
9192
]
9293
cloudformation_instances = list(vpc.instances.filter(Filters=cloudformation_filter))
9394
if cloudformation_instances:
95+
if not enable_bastion:
96+
info('bastion not enabled and instances found. Start clean up')
97+
delete_bastion_host(account, region)
98+
return
9499
for instance in cloudformation_instances:
95100
# Terminate old (stopped) Odd Systems
96101
if instance.state.get('Name') == 'stopped':
@@ -117,7 +122,7 @@ def configure_bastion_host(account: AccountData, vpc: object, region: str, base_
117122
info('check old odd security groups')
118123
cleanup_old_security_group(account, region, oddstack, vpc)
119124

120-
if not legacy_instances and not cloudformation_instances:
125+
if not legacy_instances and not cloudformation_instances and enable_bastion:
121126
try:
122127
stack = cf.Stack('Odd')
123128
info('Stack Status: {}'.format(stack.stack_status))

0 commit comments

Comments
 (0)