Skip to content

Commit

Permalink
Merge pull request #44 from DMTF/1.0.8-Tagging
Browse files Browse the repository at this point in the history
1.0.8 Versioning
  • Loading branch information
mraineri authored Jul 10, 2020
2 parents ad5b260 + 0c6c7eb commit 7a837f4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [1.0.8] - 2020-07-10
- Added option to inventory script to save information to a spreadsheet

## [1.0.7] - 2020-05-22
- Removed 'PushPowerButton' from simple reset list

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ optional arguments:
be shown
--noabsent, -noabsent
Indicates if absent devices should be skipped
--write [WRITE], -w [WRITE]
Indicates if the inventory should be written to a
spreadsheet and what the file name should be if given
```

Example: `rf_sys_inventory.py -u root -p root -r https://192.168.1.100 -details`
Expand Down
26 changes: 12 additions & 14 deletions redfish_utilities/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,47 +288,45 @@ def print_system_inventory( inventory_list, details = False, skip_absent = False
print( "" )


def write_system_inventory( inventory_list, file_name):
def write_system_inventory( inventory_list, file_name ):
"""
Write the system inventory list into a spreadsheet
Args:
inventory_list: The inventory list to write to an Excel spreadsheet
file_name: The name of the file for the spreadsheet
"""

# Excel workbook to save data extracted and parsed
workbook = xlsxwriter.Workbook(f"./{file_name}.xlsx")
workbook = xlsxwriter.Workbook( "./{}.xlsx".format( file_name ) )

worksheet = workbook.add_worksheet("Device Inventory")
cell_header_format = workbook.add_format({'bold': True, 'bg_color': 'yellow'})
cell_name_format = workbook.add_format({'bold': True})
worksheet = workbook.add_worksheet( "Device Inventory" )
cell_header_format = workbook.add_format( { 'bold': True, 'bg_color': 'yellow' } )
cell_name_format = workbook.add_format( { 'bold': True } )

column = 0
row = 0

# Adds header to Excel file
header = ["NAME", "DESCRIPTION", "MANUFACTURER", "MODEL", "SKU", "PART NUMBER", "SERIAL NUMBER", "ASSET TAG" ]
header = [ "NAME", "DESCRIPTION", "MANUFACTURER", "MODEL", "SKU", "PART NUMBER", "SERIAL NUMBER", "ASSET TAG" ]
for column_title in header:
worksheet.write(row, column, column_title, cell_header_format)
worksheet.write( row, column, column_title, cell_header_format )
column += 1
row = 1




for chassis in inventory_list:
# Go through each component type in the chassis
type_list = [ "Chassis", "Processors", "Memory", "Drives", "PCIeDevices", "StorageControllers", "NetworkAdapters" ]
for inv_type in type_list:
# Go through each component and prints its info
for item in chassis[inv_type]:
column = 0
worksheet.write(row, column, inv_type, cell_name_format)
worksheet.write( row, column, inv_type, cell_name_format )
column += 1
detail_list = [ "Description", "Manufacturer", "Model", "SKU", "PartNumber", "SerialNumber", "AssetTag" ]
for detail in detail_list:
worksheet.write(row, column, item[detail] )
worksheet.write( row, column, item[detail] )
column += 1
row += 1
workbook.close()

workbook.close()
2 changes: 1 addition & 1 deletion scripts/rf_sys_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
inventory = redfish_utilities.get_system_inventory( redfish_obj )
redfish_utilities.print_system_inventory( inventory, details = args.details, skip_absent = args.noabsent )

if(args.write):
if( args.write ):
redfish_utilities.write_system_inventory( inventory, args.write )

finally:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name = "redfish_utilities",
version = "1.0.7",
version = "1.0.8",
description = "Redfish Utilities",
long_description = long_description,
long_description_content_type = "text/markdown",
Expand Down

0 comments on commit 7a837f4

Please sign in to comment.