#NEWLINE# def main( ) : #NEWLINE# #INDENT# parser = argparse . ArgumentParser ( add_help = True , formatter_class = argparse . RawTextHelpFormatter , description = '\n    Delete server profile\n\n    Usage: ' ) #NEWLINE# parser . add_argument ( '-a' , dest = 'host' , required = True , help = '\n    HP OneView Appliance hostname or IP address' ) #NEWLINE# parser . add_argument ( '-u' , dest = 'user' , required = False , default = 'Administrator' , help = '\n    HP OneView Username' ) #NEWLINE# parser . add_argument ( '-p' , dest = 'passwd' , required = True , help = '\n    HP OneView Password' ) #NEWLINE# parser . add_argument ( '-c' , dest = 'cert' , required = False , help = '\n    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format' ) #NEWLINE# parser . add_argument ( '-y' , dest = 'proxy' , required = False , help = '\n    Proxy (host:port format' ) #NEWLINE# parser . add_argument ( '-j' , dest = 'domain' , required = False , default = 'Local' , help = '\n    HP OneView Authorized Login Domain' ) #NEWLINE# parser . add_argument ( '-f' , dest = 'force' , required = False , action = 'store_true' , help = '\n    Force the removal of the server profile' ) #NEWLINE# group = parser . add_mutually_exclusive_group ( required = True ) #NEWLINE# group . add_argument ( '-n' , dest = 'name' , help = '\n    Name of the server profile to delete' ) #NEWLINE# group . add_argument ( '-d' , dest = 'delete_all' , action = 'store_true' , help = '\n    Remove ALL server profiles and exit' ) #NEWLINE# args = parser . parse_args ( ) #NEWLINE# credential = { #NEWLINE# #INDENT# 'authLoginDomain' : args . domain . upper ( ) , #NEWLINE# 'userName' : args . user , #NEWLINE# 'password' : args . passwd , #NEWLINE# #UNINDENT# } #NEWLINE# con = hpov . connection ( args . host ) #NEWLINE# srv = hpov . servers ( con ) #NEWLINE# if args . proxy : #NEWLINE# #INDENT# con . set_proxy ( args . proxy . split ( ':' ) [ 0 ] , args . proxy . split ( ':' ) [ 1 ] ) #NEWLINE# #UNINDENT# if args . cert : #NEWLINE# #INDENT# con . set_trusted_ssl_bundle ( args . cert ) #NEWLINE# #UNINDENT# login ( con , credential ) #NEWLINE# acceptEULA ( con ) #NEWLINE# if args . delete_all : #NEWLINE# #INDENT# del_all_profiles ( srv , args . force ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# del_profile_by_name ( con , srv , args . name , args . force )