Skip to content

Commit

Permalink
refactor: changed more modules, fixed case for multiple user agents
Browse files Browse the repository at this point in the history
  • Loading branch information
rmocanu-ionos committed Jan 12, 2024
1 parent ceb54d8 commit 1bd9846
Show file tree
Hide file tree
Showing 13 changed files with 1,714 additions and 4,160 deletions.
6 changes: 2 additions & 4 deletions plugins/module_utils/common_ionos_module.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

from ansible.module_utils._text import to_native

from .common_ionos_methods import (
Expand Down Expand Up @@ -134,8 +132,8 @@ def absent_object(self, clients):
def main(self):
state = self.module.params.get('state')
clients = [sdk.ApiClient(get_sdk_config(self.module, sdk)) for sdk in self.sdks]
for client in clients:
client.user_agent = self.user_agent
for i, client in enumerate(clients):
client.user_agent = self.user_agents[i]
check_required_arguments(self.module, state, self.object_name, self.options)

try:
Expand Down
5 changes: 1 addition & 4 deletions plugins/modules/lan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
import re

HAS_SDK = True

Expand All @@ -12,12 +11,11 @@
from ionoscloud import __version__ as sdk_version
from ionoscloud.models import Lan, LanProperties
from ionoscloud.rest import ApiException
from ionoscloud import ApiClient
except ImportError:
HAS_SDK = False

from ansible import __version__
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native

from ansible_collections.ionoscloudsdk.ionoscloud.plugins.module_utils.common_ionos_module import CommonIonosModule
Expand Down Expand Up @@ -282,7 +280,6 @@ def _remove_object(self, existing_object, clients):
self.module.fail_json(msg="failed to remove the LAN: %s" % to_native(e))



if __name__ == '__main__':
ionos_module = LanModule()
if not HAS_SDK:
Expand Down
Loading

0 comments on commit 1bd9846

Please sign in to comment.