Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 14, 2024
1 parent d86e798 commit 7af9475
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/awx_plugins/inventory/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ class PluginFileInjector:
def get_proper_name(cls) -> str | None:
if cls.plugin_name is None:
return None
return f'{cls.namespace}.{cls.collection}.{cls.plugin_name}.{cls.plugin_description}'
return f'{
cls.namespace}.{
cls.collection}.{
cls.plugin_name}.{
cls.plugin_description}'

@property
def filename(self) -> str:
'''Inventory filename for using the inventory plugin This is created
dynamically, but the auto plugin requires this exact naming.''' # noqa: DAR201; FIXME
"""Inventory filename for using the inventory plugin This is created
dynamically, but the auto plugin requires this exact naming.""" # noqa: DAR201; FIXME
return f'{self.plugin_name}.yml'

def inventory_contents(self, inventory_update, private_data_dir):
'''Returns a string that is the content for the inventory file for the
inventory plugin.''' # noqa: DAR101, DAR201; FIXME
"""Returns a string that is the content for the inventory file for the
inventory plugin.""" # noqa: DAR101, DAR201; FIXME
return yaml.safe_dump(
self.inventory_as_dict(
inventory_update,
Expand All @@ -53,19 +57,19 @@ def inventory_contents(self, inventory_update, private_data_dir):

def inventory_as_dict(self, inventory_update, private_data_dir):
source_vars = dict(inventory_update.source_vars_dict) # make a copy
'''None conveys that we should use the user-provided plugin.
"""None conveys that we should use the user-provided plugin.
Note that a plugin value of '' should still be overridden.
'''
"""
if self.plugin_name is not None:
source_vars['plugin'] = (
f'''{
self.namespace
}.{
self.collection
}.{
self.plugin_name
}'''
self.namespace
}.{
self.collection
}.{
self.plugin_name
}'''
if self.use_fqcn
else self.plugin_name
)
Expand Down Expand Up @@ -95,7 +99,7 @@ def _get_shared_env(
private_data_dir,
private_data_files,
): # noqa: DAR101, DAR201; FIXME
'''By default, we will apply the standard managed injectors.'''
"""By default, we will apply the standard managed injectors."""
if self.base_injector not in {'managed', 'template'}:
return {}

Expand Down Expand Up @@ -289,7 +293,7 @@ def get_plugin_env(


class rhv(PluginFileInjector):
'''Ovirt uses the custom credential templating, and that is all.'''
"""Ovirt uses the custom credential templating, and that is all."""

plugin_name = 'ovirt'
plugin_description = 'Red Hat Virtualization'
Expand All @@ -301,7 +305,7 @@ class rhv(PluginFileInjector):


class rhv_supported(PluginFileInjector):
'''Ovirt uses the custom credential templating, and that is all.'''
"""Ovirt uses the custom credential templating, and that is all."""

plugin_name = 'ovirt'
plugin_description = 'Supported Red Hat Virtualization'
Expand Down

0 comments on commit 7af9475

Please sign in to comment.