8000 Refactor execute to use wrapper for logging by ssbarnea · Pull Request #2975 · ansible/molecule · GitHub
[go: up one dir, main page]

Skip to content

Refactor execute to use wrapper for logging - #2975

Merged
ssbarnea merged 1 commit into
masterfrom
devel
Nov 18, 2020
Merged

ssbarnea merged 1 commit into
masterfrom
devel

Conversation

@ssbarnea
Copy link
Copy Markdown
Member

Avoid each implementation of Command to call logging and use a wrapped to log executions of each subclass.

@cognifloyd
cognifloyd commented N 8000 ov 17, 2020 •
Copy link
Copy Markdown
Contributor

These commands currently do not call self.print_info():

  • init/scenario.py
  • init/role.py
  • list.py
  • login.py
  • matrix.py
  • test.py

So they probably need a dummy print_info() impl:

    def print_info(self):
        pass

@ssbarnea
Copy link
Copy Markdown
Member Author

@cognifloyd They do not need any calls because any class inheriting from command.Base will call the print_info() from the base class. That is what this change is adding as we no longer need to call it in each implementation. execute() is wrapped dynamically with the logging.

"Running ..." was present with list, login,

There are some unrelated problems with "matrix" and "check", "test" and "converge" do not produce their own sections because they are sequences, but each command within them is displayed and that was the goal.

I am not saying that the "sequences" should not print sometime but because section support in terminal is likely not nested, we would break the rendering if we would display nested ones.

We clearly need to find a way to display the sequences in a different section when we do --help, so we can decouple them from the basic commands.

Avoid each implementation of Command to call logging and use
a wrapped to log executions of each subclass.
@ssbarnea
ssbarnea merged commit 8e5c373 into master Nov 18, 2020
@ssbarnea
ssbarnea deleted the devel branch November 18, 2020 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0