mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
Improve Python code: address unused variables (#11049)
* Address F841 (unused variable). * Reformat. * Add changelog fragment. * More cleanup. * Remove trailing whitespace. * Readd removed code as a comment with TODO.
This commit is contained in:
parent
0d8521c718
commit
396f467bbb
90 changed files with 232 additions and 235 deletions
|
|
@ -167,7 +167,7 @@ try:
|
|||
import aerospike
|
||||
from time import sleep
|
||||
import re
|
||||
except ImportError as ie:
|
||||
except ImportError:
|
||||
LIB_FOUND = False
|
||||
LIB_FOUND_ERR = traceback.format_exc()
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -272,8 +272,6 @@ def main():
|
|||
if state == "absent":
|
||||
module.exit_json(changed=False, msg=f"Logical Volume {lv} does not exist.")
|
||||
|
||||
changed = False
|
||||
|
||||
this_lv = parse_lv(lv_info)
|
||||
|
||||
if state == "present" and not size:
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ def run_instance(module, ecs, exact_count):
|
|||
system_disk_size = module.params["system_disk_size"]
|
||||
system_disk_name = module.params["system_disk_name"]
|
||||
system_disk_description = module.params["system_disk_description"]
|
||||
allocate_public_ip = module.params["allocate_public_ip"]
|
||||
# allocate_public_ip = module.params["allocate_public_ip"] TODO - this is unused!
|
||||
period = module.params["period"]
|
||||
auto_renew = module.params["auto_renew"]
|
||||
instance_charge_type = module.params["instance_charge_type"]
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ def local_rpm_package_name(path):
|
|||
fd = os.open(path, os.O_RDONLY)
|
||||
try:
|
||||
header = ts.hdrFromFdno(fd)
|
||||
except rpm.error as e:
|
||||
except rpm.error:
|
||||
return None
|
||||
finally:
|
||||
os.close(fd)
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ class BtrfsSubvolumeModule:
|
|||
|
||||
mount = self.module.get_bin_path("mount", required=True)
|
||||
command = [mount, "-o", f"noatime,subvolid={int(subvolid)}", device, mountpoint]
|
||||
result = self.module.run_command(command, check_rc=True)
|
||||
self.module.run_command(command, check_rc=True)
|
||||
|
||||
return mountpoint
|
||||
|
||||
|
|
|
|||
|
|
@ -183,11 +183,6 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
result = dict(
|
||||
changed=False,
|
||||
http_code="",
|
||||
)
|
||||
|
||||
if module.check_mode:
|
||||
response, info = discord_check_mode(module)
|
||||
if info["status"] != 200:
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ def main():
|
|||
if os.path.exists(b_old) and not os.path.exists(b_new):
|
||||
try:
|
||||
os.rename(b_old, b_new)
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if not module.check_mode:
|
||||
|
|
|
|||
|
|
@ -95,13 +95,13 @@ class GitlabBranch:
|
|||
def get_project(self, project):
|
||||
try:
|
||||
return self.repo.projects.get(project)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def get_branch(self, branch):
|
||||
try:
|
||||
return self.project.branches.get(branch)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def create_branch(self, branch, ref_branch):
|
||||
|
|
@ -171,7 +171,7 @@ def main():
|
|||
try:
|
||||
this_gitlab.delete_branch(this_branch)
|
||||
module.exit_json(changed=True, msg=f"Branch {branch} deleted.")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
module.fail_json(msg="Error delete branch.", exception=traceback.format_exc())
|
||||
else:
|
||||
module.exit_json(changed=False, msg="No changes are needed.")
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ class GitLabGroup:
|
|||
member = group.members.get(gitlab_user_id)
|
||||
if member:
|
||||
return member
|
||||
except gitlab.exceptions.GitlabGetError as e:
|
||||
except gitlab.exceptions.GitlabGetError:
|
||||
return None
|
||||
|
||||
# check if the user is a member of the group
|
||||
|
|
@ -210,7 +210,7 @@ class GitLabGroup:
|
|||
# add user to a group
|
||||
def add_member_to_group(self, gitlab_user_id, gitlab_group_id, access_level):
|
||||
group = self._gitlab.groups.get(gitlab_group_id)
|
||||
add_member = group.members.create({"user_id": gitlab_user_id, "access_level": access_level})
|
||||
group.members.create({"user_id": gitlab_user_id, "access_level": access_level})
|
||||
|
||||
# remove user from a group
|
||||
def remove_user_from_group(self, gitlab_user_id, gitlab_group_id):
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class GitLabProjectMembers:
|
|||
try:
|
||||
project_exists = self._gitlab.projects.get(project_name)
|
||||
return project_exists.id
|
||||
except gitlab.exceptions.GitlabGetError as e:
|
||||
except gitlab.exceptions.GitlabGetError:
|
||||
project_exists = self._gitlab.projects.list(search=project_name, all=False)
|
||||
if project_exists:
|
||||
return project_exists[0].id
|
||||
|
|
@ -200,7 +200,7 @@ class GitLabProjectMembers:
|
|||
member = project.members.get(gitlab_user_id)
|
||||
if member:
|
||||
return member
|
||||
except gitlab.exceptions.GitlabGetError as e:
|
||||
except gitlab.exceptions.GitlabGetError:
|
||||
return None
|
||||
|
||||
# check if the user is a member of the project
|
||||
|
|
@ -213,7 +213,7 @@ class GitLabProjectMembers:
|
|||
# add user to a project
|
||||
def add_member_to_project(self, gitlab_user_id, gitlab_project_id, access_level):
|
||||
project = self._gitlab.projects.get(gitlab_project_id)
|
||||
add_member = project.members.create({"user_id": gitlab_user_id, "access_level": access_level})
|
||||
project.members.create({"user_id": gitlab_user_id, "access_level": access_level})
|
||||
|
||||
# remove user from a project
|
||||
def remove_user_from_project(self, gitlab_user_id, gitlab_project_id):
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class GitlabProtectedBranch:
|
|||
def protected_branch_exist(self, name):
|
||||
try:
|
||||
return self.project.protectedbranches.get(name)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def create_or_update_protected_branch(self, name, options):
|
||||
|
|
|
|||
|
|
@ -443,7 +443,6 @@ class Infinity:
|
|||
add a new LAN network into a given supernet Fusionlayer Infinity via rest api or default supernet
|
||||
required fields=['network_name', 'network_family', 'network_type', 'network_address','network_size' ]
|
||||
"""
|
||||
method = "post"
|
||||
resource_url = "networks"
|
||||
response = None
|
||||
if network_name is None or network_address is None or network_size is None:
|
||||
|
|
|
|||
|
|
@ -172,9 +172,6 @@ def optionDict(line, iface, option, value, address_family):
|
|||
|
||||
|
||||
def getValueFromLine(s):
|
||||
spaceRe = re.compile(r"\s+")
|
||||
m = list(spaceRe.finditer(s))[-1]
|
||||
valueEnd = m.start()
|
||||
option = s.split()[0]
|
||||
optionStart = s.find(option)
|
||||
optionLen = len(option)
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ def get_group_dict(description=None, external=None, gid=None, nonposix=None):
|
|||
|
||||
|
||||
def get_group_diff(client, ipa_group, module_group):
|
||||
data = []
|
||||
# With group_add attribute nonposix is passed, whereas with group_mod only posix can be passed.
|
||||
if "nonposix" in module_group:
|
||||
# Only non-posix groups can be changed to posix
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ def get_vault_diff(client, ipa_vault, module_vault, module):
|
|||
def ensure(module, client):
|
||||
state = module.params["state"]
|
||||
name = module.params["cn"]
|
||||
user = module.params["username"]
|
||||
# user = module.params["username"] TODO is this really not needed?
|
||||
replace = module.params["replace"]
|
||||
|
||||
module_vault = get_vault_dict(
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ def main():
|
|||
key = binascii.unhexlify(module.params["key"])
|
||||
else:
|
||||
key = None
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
module.fail_json(msg="Unable to convert 'key' from hex string.")
|
||||
|
||||
# --- run command ---
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ class JenkinsBuild:
|
|||
try:
|
||||
response = self.server.get_build_info(self.name, self.build_number)
|
||||
return response
|
||||
except jenkins.JenkinsException as e:
|
||||
except jenkins.JenkinsException:
|
||||
response = {}
|
||||
response["result"] = "ABSENT"
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class JenkinsBuildInfo:
|
|||
self.build_number = job_info["lastBuild"]["number"]
|
||||
|
||||
return self.server.get_build_info(self.name, self.build_number)
|
||||
except jenkins.JenkinsException as e:
|
||||
except jenkins.JenkinsException:
|
||||
response = {}
|
||||
response["result"] = "ABSENT"
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ class JenkinsPlugin:
|
|||
data = urlencode(script_data)
|
||||
|
||||
# Send the installation request
|
||||
r = self._get_url_data(
|
||||
self._get_url_data(
|
||||
f"{self.url}/scriptText",
|
||||
msg_status="Cannot install plugin.",
|
||||
msg_exception="Plugin installation has failed.",
|
||||
|
|
|
|||
|
|
@ -227,10 +227,7 @@ def main():
|
|||
|
||||
# Make it easier to refer to current module parameters
|
||||
name = module.params.get("name")
|
||||
force = module.params.get("force")
|
||||
state = module.params.get("state")
|
||||
enabled = module.params.get("enabled")
|
||||
provider_id = module.params.get("provider_id")
|
||||
provider_type = module.params.get("provider_type")
|
||||
parent_id = module.params.get("parent_id")
|
||||
|
||||
|
|
|
|||
|
|
@ -367,8 +367,6 @@ def main():
|
|||
name = module.params.get("name")
|
||||
force = module.params.get("force")
|
||||
state = module.params.get("state")
|
||||
enabled = module.params.get("enabled")
|
||||
provider_id = module.params.get("provider_id")
|
||||
parent_id = module.params.get("parent_id")
|
||||
|
||||
# Get a list of all Keycloak components that are of keyprovider type.
|
||||
|
|
|
|||
|
|
@ -630,7 +630,6 @@ def main():
|
|||
|
||||
# Make it easier to refer to current module parameters
|
||||
state = module.params.get("state")
|
||||
enabled = module.params.get("enabled")
|
||||
parent_id = module.params.get("parent_id")
|
||||
provider_type = module.params.get("provider_type")
|
||||
provider_id = module.params.get("provider_id")
|
||||
|
|
|
|||
|
|
@ -470,8 +470,7 @@ def main():
|
|||
service = module.params["name"]
|
||||
plist_filename = module.params["plist"]
|
||||
action = module.params["state"]
|
||||
rc = 0
|
||||
out = err = ""
|
||||
err = ""
|
||||
result = {
|
||||
"name": service,
|
||||
"changed": False,
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ def netStatParse(raw):
|
|||
pid_and_name = ""
|
||||
process = ""
|
||||
formatted_line = line.split()
|
||||
protocol, recv_q, send_q, address, foreign_address, rest = (
|
||||
protocol, _recv_q, _send_q, address, foreign_address, rest = (
|
||||
formatted_line[0],
|
||||
formatted_line[1],
|
||||
formatted_line[2],
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class ManageIQAlertProfiles:
|
|||
# if we have any updated values
|
||||
changed = True
|
||||
try:
|
||||
result = self.client.post(old_profile["href"], resource=profile_dict, action="edit")
|
||||
self.client.post(old_profile["href"], resource=profile_dict, action="edit")
|
||||
except Exception as e:
|
||||
msg = "Updating profile '{name}' failed: {error}"
|
||||
msg = msg.format(name=old_profile["name"], error=e)
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@ class ManageIQProvider:
|
|||
"""
|
||||
try:
|
||||
url = f"{self.api_url}/providers/{provider['id']}"
|
||||
result = self.client.post(url, action="refresh")
|
||||
self.client.post(url, action="refresh")
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg=f"failed to refresh provider {name}: {e}")
|
||||
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ class ManageIQTenant:
|
|||
|
||||
# try to update tenant
|
||||
try:
|
||||
result = self.client.post(tenant["href"], action="edit", resource=resource)
|
||||
self.client.post(tenant["href"], action="edit", resource=resource)
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg=f"failed to update tenant {tenant['name']}: {e}")
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ def get_facts(args=None):
|
|||
"""
|
||||
retvals, payload = dict(), dict()
|
||||
has_changed, has_failed = False, False
|
||||
msg, stderr, memset_api = None, None, None
|
||||
|
||||
payload["name"] = args["name"]
|
||||
|
||||
|
|
@ -135,14 +134,12 @@ def get_facts(args=None):
|
|||
return retvals
|
||||
|
||||
# we don't want to return the same thing twice
|
||||
msg = None
|
||||
memset_api = response.json()
|
||||
|
||||
retvals["changed"] = has_changed
|
||||
retvals["failed"] = has_failed
|
||||
for val in ["msg", "memset_api"]:
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
retvals["msg"] = None
|
||||
retvals["memset_api"] = memset_api
|
||||
|
||||
return retvals
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,6 @@ def get_facts(args=None):
|
|||
"""
|
||||
retvals, payload = dict(), dict()
|
||||
has_changed, has_failed = False, False
|
||||
msg, stderr, memset_api = None, None, None
|
||||
|
||||
payload["name"] = args["name"]
|
||||
|
||||
|
|
@ -266,14 +265,12 @@ def get_facts(args=None):
|
|||
return retvals
|
||||
|
||||
# we don't want to return the same thing twice
|
||||
msg = None
|
||||
memset_api = response.json()
|
||||
|
||||
retvals["changed"] = has_changed
|
||||
retvals["failed"] = has_failed
|
||||
for val in ["msg", "memset_api"]:
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
retvals["msg"] = None
|
||||
retvals["memset_api"] = memset_api
|
||||
|
||||
return retvals
|
||||
|
||||
|
|
|
|||
|
|
@ -273,9 +273,9 @@ def create_or_delete(args=None):
|
|||
|
||||
retvals["failed"] = has_failed
|
||||
retvals["changed"] = has_changed
|
||||
for val in ["msg", "stderr", "memset_api"]:
|
||||
if val is not None:
|
||||
retvals[val] = eval(val)
|
||||
retvals["msg"] = msg
|
||||
retvals["stderr"] = stderr
|
||||
retvals["memset_api"] = memset_api
|
||||
|
||||
return retvals
|
||||
|
||||
|
|
|
|||
|
|
@ -517,8 +517,6 @@ def main():
|
|||
)
|
||||
|
||||
service = module.params["name"]
|
||||
rc = 0
|
||||
out = err = ""
|
||||
result = {
|
||||
"name": service,
|
||||
"changed": False,
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ try:
|
|||
import pyodbc
|
||||
|
||||
HAS_PYODBC = True
|
||||
except ImportError as e:
|
||||
except ImportError:
|
||||
HAS_PYODBC = False
|
||||
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ def main():
|
|||
result["description"].append(description)
|
||||
|
||||
result["row_count"] = cursor.rowcount
|
||||
except pyodbc.ProgrammingError as pe:
|
||||
except pyodbc.ProgrammingError:
|
||||
pass
|
||||
except Exception as e:
|
||||
module.fail_json(msg=f"Exception while reading rows: {e}")
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ def change_service_permissions(module, auth, service_id, permissions):
|
|||
data = {"action": {"perform": "chmod", "params": {"octet": permissions}}}
|
||||
|
||||
try:
|
||||
status_result = open_url(
|
||||
open_url(
|
||||
f"{auth.url}/service/{service_id!s}/action",
|
||||
method="POST",
|
||||
force_basic_auth=True,
|
||||
|
|
@ -453,7 +453,7 @@ def change_service_owner(module, auth, service_id, owner_id):
|
|||
data = {"action": {"perform": "chown", "params": {"owner_id": owner_id}}}
|
||||
|
||||
try:
|
||||
status_result = open_url(
|
||||
open_url(
|
||||
f"{auth.url}/service/{service_id!s}/action",
|
||||
method="POST",
|
||||
force_basic_auth=True,
|
||||
|
|
@ -469,7 +469,7 @@ def change_service_group(module, auth, service_id, group_id):
|
|||
data = {"action": {"perform": "chgrp", "params": {"group_id": group_id}}}
|
||||
|
||||
try:
|
||||
status_result = open_url(
|
||||
open_url(
|
||||
f"{auth.url}/service/{service_id!s}/action",
|
||||
method="POST",
|
||||
force_basic_auth=True,
|
||||
|
|
@ -666,7 +666,7 @@ def delete_service(module, auth, service_id):
|
|||
return service_info
|
||||
|
||||
try:
|
||||
result = open_url(
|
||||
open_url(
|
||||
f"{auth.url}/service/{service_id!s}",
|
||||
method="DELETE",
|
||||
force_basic_auth=True,
|
||||
|
|
|
|||
|
|
@ -1271,7 +1271,6 @@ def create_exact_count_of_vms(
|
|||
vm_count_diff = exact_count - len(vm_list)
|
||||
changed = vm_count_diff != 0
|
||||
|
||||
new_vms_list = []
|
||||
instances_list = []
|
||||
tagged_instances_list = vm_list
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ def main():
|
|||
backend_name = module.params["backend"]
|
||||
name = module.params["name"]
|
||||
value = module.params["value"]
|
||||
state = module.params["state"]
|
||||
# state = module.params["state"] TODO - ???
|
||||
|
||||
if module.params["password"] is not None:
|
||||
password_method = ["-w", password]
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ def main():
|
|||
application_key = module.params.get("application_key")
|
||||
application_secret = module.params.get("application_secret")
|
||||
consumer_key = module.params.get("consumer_key")
|
||||
project = ""
|
||||
instance = ""
|
||||
ovh_billing_status = ""
|
||||
|
||||
|
|
@ -129,7 +128,7 @@ def main():
|
|||
|
||||
# Check that the instance exists
|
||||
try:
|
||||
project = client.get(f"/cloud/project/{project_id}")
|
||||
client.get(f"/cloud/project/{project_id}")
|
||||
except ovh.exceptions.ResourceNotFoundError:
|
||||
module.fail_json(msg=f"project {project_id} does not exist")
|
||||
|
||||
|
|
|
|||
|
|
@ -73,13 +73,11 @@ def query_package(module, name):
|
|||
|
||||
# Assume that if we have pkg_info, we haven't upgraded to pkgng
|
||||
if pkg_info_path:
|
||||
pkgng = False
|
||||
pkg_glob_path = module.get_bin_path("pkg_glob", True)
|
||||
module.get_bin_path("pkg_glob", True)
|
||||
# TODO: convert run_comand() argument to list!
|
||||
rc, out, err = module.run_command(f"{pkg_info_path} -e `pkg_glob {shlex_quote(name)}`", use_unsafe_shell=True)
|
||||
pkg_info_path = [pkg_info_path]
|
||||
else:
|
||||
pkgng = True
|
||||
pkg_info_path = [module.get_bin_path("pkg", True), "info"]
|
||||
rc, out, err = module.run_command(pkg_info_path + [name])
|
||||
|
||||
|
|
|
|||
|
|
@ -1118,11 +1118,11 @@ def main():
|
|||
password = module.params["password"]
|
||||
token = module.params["token"]
|
||||
server_hostname = module.params["server_hostname"]
|
||||
server_insecure = module.params["server_insecure"]
|
||||
server_prefix = module.params["server_prefix"]
|
||||
server_port = module.params["server_port"]
|
||||
rhsm_baseurl = module.params["rhsm_baseurl"]
|
||||
rhsm_repo_ca_cert = module.params["rhsm_repo_ca_cert"]
|
||||
# TODO - no longer used? module.params["server_insecure"]
|
||||
# TODO - no longer used? module.params["server_prefix"]
|
||||
# TODO - no longer used? module.params["server_port"]
|
||||
# TODO - no longer used? module.params["rhsm_baseurl"]
|
||||
# TODO - no longer used? module.params["rhsm_repo_ca_cert"]
|
||||
auto_attach = module.params["auto_attach"]
|
||||
activationkey = module.params["activationkey"]
|
||||
org_id = module.params["org_id"]
|
||||
|
|
@ -1142,10 +1142,10 @@ def main():
|
|||
consumer_name = module.params["consumer_name"]
|
||||
consumer_id = module.params["consumer_id"]
|
||||
force_register = module.params["force_register"]
|
||||
server_proxy_hostname = module.params["server_proxy_hostname"]
|
||||
server_proxy_port = module.params["server_proxy_port"]
|
||||
server_proxy_user = module.params["server_proxy_user"]
|
||||
server_proxy_password = module.params["server_proxy_password"]
|
||||
# TODO - no longer used? module.params["server_proxy_hostname"]
|
||||
# TODO - no longer used? module.params["server_proxy_port"]
|
||||
# TODO - no longer used? module.params["server_proxy_user"]
|
||||
# TODO - no longer used? module.params["server_proxy_password"]
|
||||
release = module.params["release"]
|
||||
syspurpose = module.params["syspurpose"]
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ def main():
|
|||
res = redis.connection.get(key)
|
||||
if res is not None:
|
||||
value = float(res)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
msg = f"Value: {res} of key: {key} is not incrementable(int or float)"
|
||||
result["msg"] = msg
|
||||
module.fail_json(**result)
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ def core(module):
|
|||
present_sshkeys = []
|
||||
try:
|
||||
present_sshkeys = extract_present_sshkeys(organization_json)
|
||||
except (KeyError, IndexError) as e:
|
||||
except (KeyError, IndexError):
|
||||
module.fail_json(changed=False, data="Error while extracting present SSH keys from API")
|
||||
|
||||
if state in ("present",):
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../x
|
|||
self.result["msg"] = self.success_msg
|
||||
self.result["changed"] = True
|
||||
continue
|
||||
resp = self.update_model(Model_Handle, {req_name: req_val})
|
||||
self.update_model(Model_Handle, {req_name: req_val})
|
||||
|
||||
self.module.exit_json(**self.result)
|
||||
|
||||
|
|
|
|||
|
|
@ -906,7 +906,7 @@ def handle_elastigroup(client, module):
|
|||
grace_period=roll_config.get("grace_period"),
|
||||
health_check_type=roll_config.get("health_check_type"),
|
||||
)
|
||||
roll_response = client.roll_group(group_roll=eg_roll, group_id=group_id)
|
||||
client.roll_group(group_roll=eg_roll, group_id=group_id)
|
||||
message = "Updated and started rolling the group successfully."
|
||||
|
||||
except SpotinstClientException as exc:
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ def main():
|
|||
|
||||
svc = Svc(module)
|
||||
changed = False
|
||||
orig_state = svc.report()
|
||||
dummy_orig_state = svc.report() # TODO - is this not needed?
|
||||
|
||||
if enabled is not None and enabled != svc.enabled:
|
||||
changed = True
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ def create_payload(module, uuid):
|
|||
|
||||
try:
|
||||
vmdef_json = json.dumps(vmdef)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
module.fail_json(msg="Could not create valid JSON payload", exception=traceback.format_exc())
|
||||
|
||||
# Create the temporary file that contains our payload, and set tight
|
||||
|
|
|
|||
|
|
@ -1370,7 +1370,7 @@ class XenServerVM(XenServerObject):
|
|||
# do not support subargument specs.
|
||||
try:
|
||||
num_cpus = int(num_cpus)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
self.module.fail_json(msg="VM check hardware.num_cpus: parameter should be an integer value!")
|
||||
|
||||
if num_cpus < 1:
|
||||
|
|
@ -1392,7 +1392,7 @@ class XenServerVM(XenServerObject):
|
|||
# do not support subargument specs.
|
||||
try:
|
||||
num_cpu_cores_per_socket = int(num_cpu_cores_per_socket)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
self.module.fail_json(
|
||||
msg="VM check hardware.num_cpu_cores_per_socket: parameter should be an integer value!"
|
||||
)
|
||||
|
|
@ -1423,7 +1423,7 @@ class XenServerVM(XenServerObject):
|
|||
# do not support subargument specs.
|
||||
try:
|
||||
memory_mb = int(memory_mb)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
self.module.fail_json(msg="VM check hardware.memory_mb: parameter should be an integer value!")
|
||||
|
||||
if memory_mb < 1:
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ def main():
|
|||
)
|
||||
try:
|
||||
pwd.getpwnam(name)
|
||||
except KeyError as e:
|
||||
except KeyError:
|
||||
module.fail_json(msg=f"User '{name}' does not exist.", **result)
|
||||
|
||||
elif quota_type == "group":
|
||||
|
|
@ -238,7 +238,7 @@ def main():
|
|||
)
|
||||
try:
|
||||
grp.getgrnam(name)
|
||||
except KeyError as e:
|
||||
except KeyError:
|
||||
module.fail_json(msg=f"User '{name}' does not exist.", **result)
|
||||
|
||||
elif quota_type == "project":
|
||||
|
|
|
|||
|
|
@ -920,7 +920,6 @@ def main():
|
|||
input_type = module.params["input_type"]
|
||||
print_match = module.params["print_match"]
|
||||
count = module.params["count"]
|
||||
backup = module.params["backup"]
|
||||
strip_cdata_tags = module.params["strip_cdata_tags"]
|
||||
insertbefore = module.params["insertbefore"]
|
||||
insertafter = module.params["insertafter"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue