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

Initial CLI Refactor #241

Closed
wants to merge 1 commit into from
Closed

Initial CLI Refactor #241

wants to merge 1 commit into from

Conversation

theseanything
Copy link
Contributor

@theseanything theseanything commented Oct 31, 2017

This PR refactors the CLI into the following:

  create      Creates a stack or a change set.
  delete      Deletes a stack or a change set.
  describe    Commands for describing attributes of stacks.
  execute     Executes a change set.
  generate    Prints the template.
  init        Commands for initialising Sceptre projects.
  launch      Launch a stack or environment.
  list        Commands for listing attributes of stacks.
  set-policy  Sets stack policy.
  status      Print status of stack or environment.
  update      Update a stack.
  validate    Validates the template.

The CLI has been reorganized in to a folder cli splitting up commands into separate files. The continue-update-rollback command has been removed due to improvements in CloudFormation and maintain cli consistency.


  • Wrote good commit messages.
  • Squashed related commits together after the changes have been approved.
  • Commit message starts with [Resolve #issue-number] (if a related issue exists).
  • Added unit tests.
  • Added integration tests (if applicable).
  • All unit tests (make test) are passing.
  • Used the same coding conventions as the rest of the project.
  • The new code doesn't generate flake8 (make lint) offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.

@theseanything theseanything force-pushed the cli-refactor branch 6 times, most recently from 3c7c5e0 to ac264e8 Compare October 31, 2017 18:22
Commands for listing attributes of stacks.

"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the reason for this be documented? I'm uncertain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as cli group behaviours are documented with Click documentation


"""
stack = get_stack(ctx, path)
stack.execute_change_set(change_set_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another place where this function could be placed?



@contextlib.contextmanager
def change_set(stack, name):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me like there is a better place for this function than here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove all together

return logger


def simplify_change_set_description(response):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good reason for defining this function here and describe.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup duplicated function - removed from describe.py and imported from here

@@ -0,0 +1,151 @@
import click
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of this file is slightly misleading, since it contains all of the "read only" operations, instead of just the describe commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - so realised I can't split out "list" commands in to a list.py and import list, because it clashes with built-in python keyword "list". Not sure what to rename too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating extra list.py file

Copy link
Contributor

@b-t-g b-t-g Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanding on this, we discussed offline that we can just do

from list import list_group

for the purposes of using that module within Sceptre. It is more verbose, but it makes the structure of the commands more intuitive and, thus, more maintainable.

This may cause confusion if someone wanted to use Sceptre as a Python module and import the Sceptre list.py; however, we don't officially support using cli commands as modules and users may sidestep this issue by adding the import statement:

import list as list_commands

instead.

@theseanything theseanything added this to the v2.0 milestone Nov 10, 2017
@theseanything theseanything self-assigned this Nov 15, 2017
@theseanything
Copy link
Contributor Author

Requires #259 before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants