diff --git a/library/docker_plugins.py b/library/docker_plugins.py index 6dc5fe9..9b58ca1 100644 --- a/library/docker_plugins.py +++ b/library/docker_plugins.py @@ -94,10 +94,11 @@ def run(self): if self.state == "test": """ """ - plugin_config_file = os.path.join(self.docker_data_root, "plugins", plugin_id, "config.json") + if plugin_id: + plugin_config_file = os.path.join(self.docker_data_root, "plugins", plugin_id, "config.json") - if not os.path.exists(plugin_config_file): - self.module.log(msg=f"The plugin {self.plugin_alias} is not installed under the expected data-root path {self.docker_data_root}.") + if not os.path.exists(plugin_config_file): + self.module.log(msg=f"The plugin {self.plugin_alias} is not installed under the expected data-root path {self.docker_data_root}.") return dict( changed = False, @@ -128,19 +129,18 @@ def check_plugin(self): try: p_list = self.docker_client.plugins.list() - self.module.log(msg=f" p_list : {p_list}") - for plugin in p_list: installed_plugin_enabled = plugin.enabled - - # if plugin.name == self.plugin_alias: - installed_plugin_name = plugin.name installed_plugin_shortname = plugin.name.split(':')[0] - installed_plugin_version = plugin.name.split(':')[1] - installed_plugin_id = plugin.id - installed_plugin_short_id = plugin.short_id - break + if installed_plugin_shortname == self.plugin_alias: + installed_plugin_name = plugin.name + installed_plugin_shortname = plugin.name.split(':')[0] + installed_plugin_version = plugin.name.split(':')[1] + installed_plugin_id = plugin.id + installed_plugin_short_id = plugin.short_id + + break except docker.errors.APIError as e: error = str(e) @@ -407,7 +407,7 @@ def __read_docker_config(self, config_file="/etc/docker/daemon.json"): def __write_plugin_information(self, data): """ """ - self.module.log(msg=f" write information to '{self.plugin_information_file}'") + self.module.log(msg=f"persist plugin information in '{self.plugin_information_file}'") with open(self.plugin_information_file, 'w') as fp: json_data = json.dumps(data, indent=2, sort_keys=False) diff --git a/molecule/dockerd-with-client-config/requirements.yml b/molecule/dockerd-with-client-config/requirements.yml index f804915..751d345 100644 --- a/molecule/dockerd-with-client-config/requirements.yml +++ b/molecule/dockerd-with-client-config/requirements.yml @@ -1,7 +1,7 @@ --- - name: snakeoil - src: bodsch.snakeoil - version: 1.3.1 + src: https://github.com/bodsch/ansible-snakeoil + version: 1.5.0 ... diff --git a/molecule/dockerd-with-plugin/requirements.yml b/molecule/dockerd-with-plugin/requirements.yml index 3a6c3be..aa1cfbb 100644 --- a/molecule/dockerd-with-plugin/requirements.yml +++ b/molecule/dockerd-with-plugin/requirements.yml @@ -1,7 +1,7 @@ --- - name: loki - src: bodsch.loki + src: https://github.com/bodsch/ansible-loki version: 2.1.0 ... diff --git a/molecule/dockerd-with-tls/requirements.yml b/molecule/dockerd-with-tls/requirements.yml index f804915..751d345 100644 --- a/molecule/dockerd-with-tls/requirements.yml +++ b/molecule/dockerd-with-tls/requirements.yml @@ -1,7 +1,7 @@ --- - name: snakeoil - src: bodsch.snakeoil - version: 1.3.1 + src: https://github.com/bodsch/ansible-snakeoil + version: 1.5.0 ...