Skip to content

Commit

Permalink
Merge pull request #26 from device42/D42-13473
Browse files Browse the repository at this point in the history
D42-13473 - Warranty Scripts: Cisco Meraki Support
Added Meraki support.
  • Loading branch information
cscaglioned42 committed Oct 5, 2019
2 parents 55b5d6f + c8a108b commit 11cf601
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
## 11.09.2018
- Added Meraki device support

## 30.04.2017
- service type field has been extended in version 13.1.0.
- Added an option to force updating the line items. Needed as the Service Type does not get updated otherwise as the contents of the field can't be checked via the api to see if it needs a change.
Expand Down
26 changes: 13 additions & 13 deletions Files/shared.py
Expand Up @@ -38,12 +38,12 @@ def get_config(self, source):
res = self.__get_dell_cfg()
elif source == 'hp':
res = self.__get_hp_cfg()
elif source == 'cisco':
res = self.__get_cisco_cfg()
elif source == 'ibm':
res = self.__get_ibm_cfg()
elif source == 'lenovo':
res = self.__get_lenovo_cfg()
elif source == 'meraki':
res = self.__get_meraki_cfg()
else:
print '\n[!] Error. Unknown source "%s".\n\tExiting...\n' % source
sys.exit()
Expand All @@ -67,12 +67,14 @@ def __get_discover_cfg(self):
hp = self.cc.getboolean('discover', 'hp')
ibm = self.cc.getboolean('discover', 'ibm')
lenovo = self.cc.getboolean('discover', 'lenovo')
meraki = self.cc.getboolean('discover', 'meraki')
forcedupdate = self.cc.getboolean('discover', 'forcedupdate')
return {
'dell': dell,
'hp': hp,
'ibm': ibm,
'lenovo': lenovo,
'meraki': meraki,
'forcedupdate': forcedupdate
}

Expand All @@ -96,17 +98,6 @@ def __get_hp_cfg(self):
'api_secret': hp_api_secret
}

def __get_cisco_cfg(self):
# Cisco --------------------------------------------
cisco_url = self.cc.get('cisco', 'url')
cisco_api_key = self.cc.get('cisco', 'api_key')
cisco_api_secret = self.cc.get('cisco', 'api_secret')
return {
'url': cisco_url,
'api_key': cisco_api_key,
'api_secret': cisco_api_secret
}

def __get_ibm_cfg(self):
# IBM ---------------------------------------------
ibm_url = self.cc.get('ibm', 'url')
Expand All @@ -125,6 +116,15 @@ def __get_lenovo_cfg(self):
'url2': lenovo_url2
}

def __get_meraki_cfg(self):
# Meraki ---------------------------------------------
meraki_url = self.cc.get('meraki', 'url')
meraki_api_key = self.cc.get('meraki', 'api_key')
return {
'url': meraki_url,
'api_key': meraki_api_key
}


class Device42rest:
def __init__(self, params):
Expand Down
5 changes: 5 additions & 0 deletions Files/warranty.cfg.example
Expand Up @@ -10,6 +10,7 @@ dell = True
hp = True
ibm = True
lenovo = True
meraki = True
forcedupdate = False

[dell]
Expand All @@ -31,6 +32,10 @@ url2 = http://support.lenovo.com/us/en/products
url = http://support.lenovo.com/services/us/en/ContentService/GetProducts
url2 = http://support.lenovo.com/us/en/products

[meraki]
api_key =
url = https://api.meraki.com/api/v0

[other]
# print verbose info to STDOUT
debug = True
Expand Down
1 change: 0 additions & 1 deletion Files/warranty_dell.py
Expand Up @@ -34,7 +34,6 @@ def run_warranty_check(self, inline_serials, retry=True):
print '\t[+] Checking warranty info for "%s"' % inline_serials
timeout = 10


# making sure the warranty also gets updated if the serial has been changed by decom lifecycle process
incoming_serials = inline_serials.split(',')
inline_serials = []
Expand Down

0 comments on commit 11cf601

Please sign in to comment.