Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] added support for stack output #129

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cloudlift/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,11 @@ def start_session(name, environment, mfa, component):
SessionCreator(name, environment).start_session(mfa, component)


@cli.command(help="Get Service stack Output details")
@_require_environment
@_require_name
def service_output(name, environment):
ServiceInformationFetcher(name, environment).get_stack_outputs()

if __name__ == '__main__':
cli()
17 changes: 16 additions & 1 deletion cloudlift/deployment/service_information_fetcher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

from subprocess import call

from terminaltables import SingleTable
from click import confirm, edit, prompt

from cloudlift.exceptions import UnrecoverableException
Expand Down Expand Up @@ -33,6 +33,12 @@ def init_stack_info(self):
stack['Outputs']
)
)
self.output = list(
filter(
lambda x: x['OutputKey'],
stack['Outputs']
)
)
self.ecs_display_names = [
svc_name['OutputKey'] for svc_name in service_name_list
]
Expand Down Expand Up @@ -168,3 +174,12 @@ def _fetch_current_task_definition_tag(self):
return commit_sha
except Exception:
return None

def get_stack_outputs(self):
changes_to_show = [["Name", "Value"]]
for svc_name in self.output:
if svc_name['OutputKey'] != "CloudliftOptions":
changes_to_show.append([
svc_name['OutputKey'], svc_name['OutputValue']])
print(SingleTable(changes_to_show).table)