def main(): # Creates a connection with the appliance. con = hpICsp.connection(parentIP) # Create objects for all necessary resources. st = hpICsp.settings(con) # Login into master/parent appliance. credential = {'userName': parentUser, 'password': parentPassword} con.login(credential) # Export appliance content bytesContent = st.export_content() # Write content to a zip file and set appropriate permissions. newFile = open("content.zip", "wb") newFile.write(bytesContent) os.chmod("content.zip", stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) newFile.close() # Logout of parent appliance. con.logout() # For each child appliance, create a connection, log in, import the master's content, and log out. for x in range(0, len(childIPs)): con = hpICsp.connection(childIPs[x]) credential = {'userName': childUsers[x], 'password': childPasswords[x]} con.login(credential) st = hpICsp.settings(con) st.import_content("content.zip") con.logout()
def main(): # Creates a connection with the appliance. con = hpICsp.connection(applianceIP) # Create objects for all necessary resources. st = hpICsp.settings(con) # Login using parsed login information credential = {'userName': applianceUser, 'password': appliancePassword} con.login(credential) # Export appliance content bytesContent = st.export_content() # Write content to zip file containing current time. name = ("Backup " + time.strftime("%c") + ".zip") newFile = open(name, "wb") newFile.write(bytesContent) os.chmod(name, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) newFile.close() # Logout of appliance con.logout()
def main(): #Creates a connection with the appliance. con=hpICsp.connection(applianceIP) #Create objects for all necessary resources. st=hpICsp.settings(con) #Login using parsed login information credential = {'userName': applianceUser, 'password': appliancePassword} con.login(credential) #Export appliance content bytesContent=st.export_content() #Write content to zip file containing current time. name=("Backup " + time.strftime("%c") + ".zip") newFile = open (name, "wb") newFile.write(bytesContent) os.chmod(name, stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU) newFile.close() #Logout of appliance con.logout()