#NEWLINE# def copy_profile( con , srv , sto , name , dest , server , sht ) : #NEWLINE# #INDENT# profiles = srv . get_server_profiles ( ) #NEWLINE# for profile in profiles : #NEWLINE# #INDENT# if ( profile [ 'name' ] == dest ) : #NEWLINE# #INDENT# print ( 'Error: profile with name' , dest , 'already exsists' ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# #UNINDENT# for profile in profiles : #NEWLINE# #INDENT# if ( profile [ 'name' ] == name ) : #NEWLINE# #INDENT# print ( ( 'Copying Profile %s' % profile [ 'name' ] ) ) #NEWLINE# profile [ 'name' ] = dest #NEWLINE# if ( 'serverHardwareUri' in profile ) : #NEWLINE# #INDENT# if ( server is not None ) : #NEWLINE# #INDENT# profile [ 'serverHardwareUri' ] = server [ 'uri' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# del profile [ 'serverHardwareUri' ] #NEWLINE# #UNINDENT# #UNINDENT# if ( 'uri' in sht ) : #NEWLINE# #INDENT# profile [ 'serverHardwareTypeUri' ] = sht [ 'uri' ] #NEWLINE# #UNINDENT# if ( 'created' in profile ) : #NEWLINE# #INDENT# del profile [ 'created' ] #NEWLINE# #UNINDENT# if ( 'serialNumber' in profile ) : #NEWLINE# #INDENT# del profile [ 'serialNumber' ] #NEWLINE# #UNINDENT# if ( 'taskUri' in profile ) : #NEWLINE# #INDENT# del profile [ 'taskUri' ] #NEWLINE# #UNINDENT# if ( 'uri' in profile ) : #NEWLINE# #INDENT# del profile [ 'uri' ] #NEWLINE# #UNINDENT# if ( 'uuid' in profile ) : #NEWLINE# #INDENT# del profile [ 'uuid' ] #NEWLINE# #UNINDENT# if ( 'enclosureBay' in profile ) : #NEWLINE# #INDENT# del profile [ 'enclosureBay' ] #NEWLINE# #UNINDENT# if ( 'enclosureUri' in profile ) : #NEWLINE# #INDENT# del profile [ 'enclosureUri' ] #NEWLINE# #UNINDENT# if ( 'connections' in profile ) : #NEWLINE# #INDENT# connections = profile [ 'connections' ] #NEWLINE# for conn in connections : #NEWLINE# #INDENT# if ( 'interconnectUri' in conn ) : #NEWLINE# #INDENT# del conn [ 'interconnectUri' ] #NEWLINE# #UNINDENT# if ( 'allocatedMbps' in conn ) : #NEWLINE# #INDENT# del conn [ 'allocatedMbps' ] #NEWLINE# #UNINDENT# if ( 'deploymentStatus' in conn ) : #NEWLINE# #INDENT# del conn [ 'deploymentStatus' ] #NEWLINE# #UNINDENT# if ( 'macType' in conn ) : #NEWLINE# #INDENT# if ( conn [ 'macType' ] == 'Virtual' ) : #NEWLINE# #INDENT# if ( 'mac' in conn ) : #NEWLINE# #INDENT# del conn [ 'mac' ] #NEWLINE# #UNINDENT# if ( 'wwpnType' in conn ) : #NEWLINE# #INDENT# if ( conn [ 'wwpnType' ] == 'Virtual' ) : #NEWLINE# #INDENT# if ( 'wwnn' in conn ) : #NEWLINE# #INDENT# del conn [ 'wwnn' ] #NEWLINE# #UNINDENT# if ( 'wwpn' in conn ) : #NEWLINE# #INDENT# del conn [ 'wwpn' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( 'sanStorage' in profile ) : #NEWLINE# #INDENT# if ( profile [ 'sanStorage' ] [ 'manageSanStorage' ] is True ) : #NEWLINE# #INDENT# san_storage = fix_san ( con , sto , profile [ 'sanStorage' ] ) #NEWLINE# profile [ 'sanStorage' ] = san_storage #NEWLINE# #UNINDENT# #UNINDENT# ret = srv . post_server_profile ( profile ) #NEWLINE# if ( 'serialNumberType' in ret ) : #NEWLINE# #INDENT# print ( '\n\nName:                ' , ret [ 'name' ] ) #NEWLINE# print ( 'Description:         ' , ret [ 'description' ] ) #NEWLINE# print ( 'Type:                ' , ret [ 'type' ] ) #NEWLINE# print ( 'wwnType:             ' , ret [ 'wwnType' ] ) #NEWLINE# print ( 'macType:             ' , ret [ 'macType' ] ) #NEWLINE# print ( 'serialNumberType:    ' , ret [ 'serialNumberType' ] ) #NEWLINE# print ( 'Firmware:' ) #NEWLINE# print ( '  manageFirmware:       ' , ret [ 'firmware' ] [ 'manageFirmware' ] ) #NEWLINE# print ( '  forceInstallFirmware: ' , ret [ 'firmware' ] [ 'forceInstallFirmware' ] ) #NEWLINE# print ( '  firmwareBaselineUri:  ' , ret [ 'firmware' ] [ 'firmwareBaselineUri' ] ) #NEWLINE# print ( 'Bios:' ) #NEWLINE# print ( '  manageBios:         ' , ret [ 'bios' ] [ 'manageBios' ] ) #NEWLINE# print ( '  overriddenSettings: ' , ret [ 'bios' ] [ 'overriddenSettings' ] ) #NEWLINE# print ( 'Boot:' ) #NEWLINE# print ( '  manageBoot:         ' , ret [ 'boot' ] [ 'manageBoot' ] ) #NEWLINE# print ( '  order:              ' , ret [ 'boot' ] [ 'order' ] , '\n' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pprint ( ret ) #NEWLINE# #UNINDENT# sys . exit ( 0 ) #NEWLINE# #UNINDENT# #UNINDENT# print ( ( 'Can not locate profile: %s' % name ) )