def insert_table(self, dict, path): path = self.path + path print "%s" % (path) for key, value in dict.items(): subs = "ssl" res = re.search(subs, key) registry = RegistryHelper() type = REG_SZ if res is not None: type = REG_DWORD registry.set_reg_value(HKEY_LOCAL_MACHINE, path, key, value, type)
def reset_fedid_reg(self): path = "\state" key = "subdomain" value = RegistryHelper.get_reg_value(HKEY_LOCAL_MACHINE, self.path + path, key) if value is not None: self.insert_sz_value(path, key, "") else: print "The key is not exist."
def prepare_environment(env): FRYR_CONFIG['ENVIRONMENT']['TEST_ENV'] = env with open(FRYR_CONFIG_FILE, 'w') as outfile: outfile.write(yaml.dump(FRYR_CONFIG, default_flow_style=False)) hkey1 = 'HKLM\Software\Mozy Restore Manager' hkey2 = 'HKCU\Software\Mozy Restore Manager' RegistryHelper.write_reg_as_admin(hkey1, 'loglevel', '5', 'REG_DWORD') RegistryHelper.write_reg_as_admin(hkey1, 'log.debugmask', 'mordor:Oauth|mordor:http:client', 'REG_SZ') RegistryHelper.write_reg_as_admin(hkey1, 'log.tracemask', 'mordor:http:client', 'REG_SZ') RegistryHelper.write_reg_as_admin(hkey1, 'ssl.verifyhostname', '0', 'REG_DWORD') RegistryHelper.write_reg_as_admin(hkey1, 'ssl.verifypeercertificate', '0', 'REG_DWORD') RegistryHelper.write_reg_as_admin(hkey2, 'loglevel', '5', 'REG_DWORD') RegistryHelper.write_reg_as_admin(hkey2, 'log.debugmask', 'mordor:Oauth|mordor:http:client', 'REG_SZ') RegistryHelper.write_reg_as_admin(hkey2, 'log.tracemask', 'mordor:http:client', 'REG_SZ') RegistryHelper.write_reg_as_admin(hkey2, 'ssl.verifyhostname', '0', 'REG_DWORD') RegistryHelper.write_reg_as_admin(hkey2, 'ssl.verifypeercertificate', '0', 'REG_DWORD') RegistryHelper.write_reg_as_admin( hkey1, 'ahost', FRYR_CONFIG['CREDENTIAL'][env]['AHOST'], 'REG_SZ') RegistryHelper.write_reg_as_admin( hkey1, 'bhost', FRYR_CONFIG['CREDENTIAL'][env]['BHOST'], 'REG_SZ') RegistryHelper.write_reg_as_admin( hkey1, 'thost', FRYR_CONFIG['CREDENTIAL'][env]['THOST'], 'REG_SZ') RegistryHelper.write_reg_as_admin( hkey2, 'ahost', FRYR_CONFIG['CREDENTIAL'][env]['AHOST'], 'REG_SZ') RegistryHelper.write_reg_as_admin( hkey2, 'bhost', FRYR_CONFIG['CREDENTIAL'][env]['BHOST'], 'REG_SZ') RegistryHelper.write_reg_as_admin( hkey2, 'thost', FRYR_CONFIG['CREDENTIAL'][env]['THOST'], 'REG_SZ')
def insert_dword_value(self, path, key, value): path = self.path + path registry = RegistryHelper() registry.set_reg_value(HKEY_LOCAL_MACHINE, path, key, value, REG_DWORD)
def read_configure_status(self): path = self.path + "\state" key = "configured" value = RegistryHelper.get_reg_value(HKEY_LOCAL_MACHINE, path, key) return value
def set_unconfigured(self): path = self.path + "\state" key = "configured" RegistryHelper.set_reg_value(HKEY_LOCAL_MACHINE, path, key, 0, REG_DWORD) self.reset_fedid_reg()
def clear_reg(self, subkey): path = self.path print path registry = RegistryHelper() registry.delete_key(HKEY_LOCAL_MACHINE, path, subkey)
def change_host(self, key, value, fedid=True): if fedid: path = r"SOFTWARE" + "\\" + self.oem + "\options" RegistryHelper.set_reg_value(HKEY_LOCAL_MACHINE, path, key, value, REG_SZ)
def get_catch_path(self): path = self.path key = "DataPath" value = RegistryHelper.get_reg_value(HKEY_LOCAL_MACHINE, path, key) print value return value
def get_configuration_path(self): path = self.path key = "ConfigPath" value = RegistryHelper.get_reg_value(HKEY_LOCAL_MACHINE, path, key) print value return value