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

Include driver information alongside version #2900

Merged
merged 1 commit into from
Oct 19, 2020
Merged
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
4 changes: 4 additions & 0 deletions lib/molecule/driver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import inspect
import os

import pkg_resources

import molecule
from molecule.status import Status

Expand All @@ -41,6 +43,8 @@ def __init__(self, config=None):
"""
self._config = config
self._path = os.path.abspath(os.path.dirname(inspect.getfile(self.__class__)))
self.module = self.__module__.split(".")[0]
self.version = pkg_resources.get_distribution(self.module).version

@property # type: ignore
@abc.abstractmethod
Expand Down
14 changes: 5 additions & 9 deletions lib/molecule/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import molecule
from molecule import command
from molecule.api import drivers
from molecule.command.base import click_group_ex
from molecule.config import MOLECULE_DEBUG, ansible_version
from molecule.logger import should_do_markup
Expand All @@ -51,15 +52,10 @@ def _version_string() -> str:
color = "bright_yellow" if v.is_prerelease else "green" # type: ignore
msg = "molecule %s\n" % _colorize(molecule.__version__, color)

msg += _colorize(
" ansible==%s python==%s.%s"
% (
ansible_version(),
sys.version_info[0],
sys.version_info[1],
),
"bright_black",
)
details = f" ansible:{ansible_version()} python:{sys.version_info[0]}.{sys.version_info[1]}"
for driver in drivers():
details += f"\n {driver}:{driver.version} from {driver.module}"
msg += _colorize(details, "bright_black")
return msg


Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ install_requires =
pluggy >= 0.7.1, < 1.0
PyYAML >= 5.1, < 6
sh >= 1.13.1, < 1.14
setuptools >= 42 # for pkg_resources
tabulate >= 0.8.4
tree-format >= 0.1.2
yamllint >= 1.15.0, < 2
Expand Down