接口去掉
This commit is contained in:
parent
67fb126246
commit
80444c15a0
|
@ -61,7 +61,7 @@ class UpgradeStrategies():
|
|||
self.sqlite3_server = Sqlite3Server(self)
|
||||
# self.simulate_mode = SimulateTerminal()
|
||||
# self.install_mode = UpdateInstallMode(self)
|
||||
self.apt_p2p_config = AptP2pConfigManager()
|
||||
# self.apt_p2p_config = AptP2pConfigManager()
|
||||
# self._reload_options_config()
|
||||
# self._refresh_cache_only()
|
||||
|
||||
|
@ -118,23 +118,3 @@ class UpgradeStrategies():
|
|||
timeout=300)
|
||||
logging.error("Dbus has not withdrawn and retry reboot times:%d...",retry_reboot_times)
|
||||
time.sleep(1)
|
||||
|
||||
class AptP2pConfigManager():
|
||||
APT_P2P_FILE = "/etc/apt-p2p/apt-p2p.conf"
|
||||
HEADER_DSC = "apt-p2p config(/etc/apt-p2p/apt-p2p.conf) is not exists..."
|
||||
def __init__(self):
|
||||
if os.path.exists(self.APT_P2P_FILE):
|
||||
self.p2pConfigs = UpgradeConfig(datadir = "/etc/apt-p2p/", name = "apt-p2p.conf")
|
||||
else:
|
||||
self.p2pConfigs = None
|
||||
|
||||
def get_bootstrap(self):
|
||||
if self.p2pConfigs == None:
|
||||
return self.HEADER_DSC
|
||||
|
||||
return self.p2pConfigs.getWithDefault("apt_p2p_Khashmir", "BOOTSTRAP", "Failed")
|
||||
|
||||
def set_bootstrap(self,value):
|
||||
if self.p2pConfigs == None:
|
||||
return self.HEADER_DSC
|
||||
self.p2pConfigs.setValue("apt_p2p_Khashmir","BOOTSTRAP",str(value))
|
||||
|
|
|
@ -72,47 +72,6 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
mainloop.quit()
|
||||
logging.debug("Exit")
|
||||
|
||||
#set config value
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='sss',out_signature='b')
|
||||
def SetConfigValue(self,section, option, value):
|
||||
try:
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' SetConfigValue ...')
|
||||
if self.parent.configs_uncover.has_section(str(section)) and self.parent.configs_uncover.has_option(str(section),str(option)):
|
||||
if self.parent.configs_uncover.setValue(str(section), str(option),str(value)) == True:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
elif self.parent.sqlite3_server.ucconfigs.has_section(str(section)) and self.parent.sqlite3_server.ucconfigs.has_option(str(section),str(option)):
|
||||
if self.parent.sqlite3_server.ucconfigs.setValue(str(section), str(option),str(value)) == True:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
return False
|
||||
|
||||
#get config value
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='ss',out_signature='bs')
|
||||
def GetConfigValue(self,section, option):
|
||||
try:
|
||||
if self.parent.configs_cover.has_section(str(section)) and self.parent.configs_cover.has_option(str(section),str(option)):
|
||||
value = str(self.parent.configs_cover.get(str(section), str(option)))
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+" GetConfigValue section:%s option:%s value:%s ...",section,option,value)
|
||||
return True,value
|
||||
if self.parent.configs_uncover.has_section(str(section)) and self.parent.configs_uncover.has_option(str(section),str(option)):
|
||||
value = str(self.parent.configs_uncover.get(str(section), str(option)))
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+" GetConfigValue section:%s option:%s value:%s ...",section,option,value)
|
||||
return True,value
|
||||
elif self.parent.sqlite3_server.ucconfigs.has_section(str(section)) and self.parent.sqlite3_server.ucconfigs.has_option(str(section),str(option)):
|
||||
value = str(self.parent.sqlite3_server.ucconfigs.get(str(section), str(option)))
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+" GetConfigValue section:%s option:%s value:%s ...",section,option,value)
|
||||
return True,value
|
||||
else:
|
||||
logging.warning("Warning: Can't found section:%s option:%s ... ",section, option)
|
||||
except Exception as e:
|
||||
logging.error("Error: GetConfigValue section:%s option:%s, %s.",section, option, e)
|
||||
return False,''
|
||||
|
||||
#设置数据库配置信息
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='ss',out_signature='b',sender_keyword='sender')
|
||||
def DatabaseInfoSet(self,field_name,field_value,sender=None):
|
||||
|
|
Loading…
Reference in New Issue