mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Python code modernization, 5/n (#1165)
* Address raise-missing-from. * Address simplifiable-if-expression. * Address unnecessary-dunder-call. * Address unnecessary-pass. * Address use-list-literal. * Address unused-variable. * Address use-dict-literal.
This commit is contained in:
@@ -184,19 +184,19 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||
raise AnsibleError(msg)
|
||||
|
||||
def _populate(self):
|
||||
raw_params = dict(
|
||||
docker_host=self.get_option("docker_host"),
|
||||
tls=self.get_option("tls"),
|
||||
tls_verify=self.get_option("validate_certs"),
|
||||
key_path=self.get_option("client_key"),
|
||||
cacert_path=self.get_option("ca_path"),
|
||||
cert_path=self.get_option("client_cert"),
|
||||
tls_hostname=self.get_option("tls_hostname"),
|
||||
api_version=self.get_option("api_version"),
|
||||
timeout=self.get_option("timeout"),
|
||||
use_ssh_client=self.get_option("use_ssh_client"),
|
||||
debug=None,
|
||||
)
|
||||
raw_params = {
|
||||
"docker_host": self.get_option("docker_host"),
|
||||
"tls": self.get_option("tls"),
|
||||
"tls_verify": self.get_option("validate_certs"),
|
||||
"key_path": self.get_option("client_key"),
|
||||
"cacert_path": self.get_option("ca_path"),
|
||||
"cert_path": self.get_option("client_cert"),
|
||||
"tls_hostname": self.get_option("tls_hostname"),
|
||||
"api_version": self.get_option("api_version"),
|
||||
"timeout": self.get_option("timeout"),
|
||||
"use_ssh_client": self.get_option("use_ssh_client"),
|
||||
"debug": None,
|
||||
}
|
||||
update_tls_hostname(raw_params)
|
||||
connect_params = get_connect_params(raw_params, fail_function=self._fail)
|
||||
client = docker.DockerClient(**connect_params)
|
||||
@@ -305,7 +305,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||
except Exception as e:
|
||||
raise AnsibleError(
|
||||
f"Unable to fetch hosts from Docker swarm API, this was the original exception: {e}"
|
||||
)
|
||||
) from e
|
||||
|
||||
def verify_file(self, path):
|
||||
"""Return the possibly of a file being consumable by this plugin."""
|
||||
|
||||
Reference in New Issue
Block a user