Removed unused variable definitions and library imports

pull/41656/head
Jose Delarosa 7 years ago
parent d093d1be02
commit 82211c97d8

@ -190,7 +190,6 @@ class RedfishUtils(object):
def get_logs(self): def get_logs(self):
log_svcs_uri_list = [] log_svcs_uri_list = []
list_of_logs = [] list_of_logs = []
result = {}
# Find LogService # Find LogService
response = self.get_request(self.root_uri + self.manager_uri) response = self.get_request(self.root_uri + self.manager_uri)
@ -238,8 +237,6 @@ class RedfishUtils(object):
return {'ret': True, 'list_of_logs': list_of_logs} return {'ret': True, 'list_of_logs': list_of_logs}
def clear_logs(self): def clear_logs(self):
result = {}
# Find LogService # Find LogService
response = self.get_request(self.root_uri + self.manager_uri) response = self.get_request(self.root_uri + self.manager_uri)
if response['ret'] is False: if response['ret'] is False:
@ -402,7 +399,6 @@ class RedfishUtils(object):
def list_users(self): def list_users(self):
# listing all users has always been slower than other operations, why? # listing all users has always been slower than other operations, why?
result = {}
allusers = [] allusers = []
allusers_details = [] allusers_details = []
response = self.get_request(self.root_uri + self.accounts_uri) response = self.get_request(self.root_uri + self.accounts_uri)
@ -430,7 +426,6 @@ class RedfishUtils(object):
return {'ret': True, 'entries': allusers_details} return {'ret': True, 'entries': allusers_details}
def add_user(self, user): def add_user(self, user):
result = {}
uri = self.root_uri + self.accounts_uri + "/" + user['userid'] uri = self.root_uri + self.accounts_uri + "/" + user['userid']
username = {'UserName': user['username']} username = {'UserName': user['username']}
pswd = {'Password': user['userpswd']} pswd = {'Password': user['userpswd']}
@ -443,7 +438,6 @@ class RedfishUtils(object):
return {'ret': True} return {'ret': True}
def enable_user(self, user): def enable_user(self, user):
result = {}
uri = self.root_uri + self.accounts_uri + "/" + user['userid'] uri = self.root_uri + self.accounts_uri + "/" + user['userid']
payload = {'Enabled': True} payload = {'Enabled': True}
response = self.patch_request(uri, payload, HEADERS) response = self.patch_request(uri, payload, HEADERS)
@ -452,7 +446,6 @@ class RedfishUtils(object):
return {'ret': True} return {'ret': True}
def delete_user(self, user): def delete_user(self, user):
result = {}
uri = self.root_uri + self.accounts_uri + "/" + user['userid'] uri = self.root_uri + self.accounts_uri + "/" + user['userid']
payload = {'UserName': ""} payload = {'UserName': ""}
response = self.patch_request(uri, payload, HEADERS) response = self.patch_request(uri, payload, HEADERS)
@ -461,7 +454,6 @@ class RedfishUtils(object):
return {'ret': True} return {'ret': True}
def disable_user(self, user): def disable_user(self, user):
result = {}
uri = self.root_uri + self.accounts_uri + "/" + user['userid'] uri = self.root_uri + self.accounts_uri + "/" + user['userid']
payload = {'Enabled': False} payload = {'Enabled': False}
response = self.patch_request(uri, payload, HEADERS) response = self.patch_request(uri, payload, HEADERS)
@ -470,7 +462,6 @@ class RedfishUtils(object):
return {'ret': True} return {'ret': True}
def update_user_role(self, user): def update_user_role(self, user):
result = {}
uri = self.root_uri + self.accounts_uri + "/" + user['userid'] uri = self.root_uri + self.accounts_uri + "/" + user['userid']
payload = {'RoleId': user['userrole']} payload = {'RoleId': user['userrole']}
response = self.patch_request(uri, payload, HEADERS) response = self.patch_request(uri, payload, HEADERS)
@ -479,7 +470,6 @@ class RedfishUtils(object):
return {'ret': True} return {'ret': True}
def update_user_password(self, user): def update_user_password(self, user):
result = {}
uri = self.root_uri + self.accounts_uri + "/" + user['userid'] uri = self.root_uri + self.accounts_uri + "/" + user['userid']
payload = {'Password': user['userpswd']} payload = {'Password': user['userpswd']}
response = self.patch_request(uri, payload, HEADERS) response = self.patch_request(uri, payload, HEADERS)
@ -489,7 +479,6 @@ class RedfishUtils(object):
def get_firmware_inventory(self): def get_firmware_inventory(self):
result = {} result = {}
devices = []
response = self.get_request(self.root_uri + self.firmware_uri) response = self.get_request(self.root_uri + self.firmware_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
@ -640,7 +629,6 @@ class RedfishUtils(object):
return {'ret': True} return {'ret': True}
def set_manager_attributes(self, attr): def set_manager_attributes(self, attr):
result = {}
attributes = "Attributes" attributes = "Attributes"
# Example: manager_attr = {\"name\":\"value\"} # Example: manager_attr = {\"name\":\"value\"}

@ -25,7 +25,7 @@ options:
required: true required: true
description: description:
- Action category to execute on server - Action category to execute on server
choices: ["Inventory", "Accounts", "System", "Update", "Manager", "Chassis"] choices: ["Inventory", "Accounts", "System", "Update", "Manager"]
command: command:
required: true required: true
description: description:
@ -88,8 +88,6 @@ result:
sample: List of CPUs on system sample: List of CPUs on system
''' '''
import os
import json
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.redfish_utils import RedfishUtils from ansible.module_utils.redfish_utils import RedfishUtils
@ -98,7 +96,7 @@ def main():
result = {} result = {}
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
category=dict(required=True, choices=["Inventory", "Accounts", "System", "Update", "Manager", "Chassis"]), category=dict(required=True, choices=["Inventory", "Accounts", "System", "Update", "Manager"]),
command=dict(), command=dict(),
baseuri=dict(required=True), baseuri=dict(required=True),
user=dict(required=True), user=dict(required=True),

Loading…
Cancel
Save