mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 15:32:19 +03:00
registration failed handled
This commit is contained in:
parent
1e3377c048
commit
98784905dd
2 changed files with 9 additions and 8 deletions
|
@ -114,12 +114,12 @@ class AhenkDeamon(BaseDaemon):
|
|||
def check_registration(self):
|
||||
max_attemp_number = int(System.Hardware.Network.interface_size()) * 3
|
||||
logger = Scope.getInstance().getLogger()
|
||||
|
||||
try:
|
||||
while Scope.getInstance().getRegistration().is_registered() is False:
|
||||
max_attemp_number -= 1
|
||||
logger.debug('[AhenkDeamon] Ahenk is not registered. Attempting for registration')
|
||||
# TODO 'Could not reach Registration response from Lider. Be sure Lider is awake and it is connected to XMPP server!'
|
||||
|
||||
# TODO 'Could not reach Registration response from Lider. Be sure Lider is running and it is connected to XMPP server!'
|
||||
Scope.getInstance().getRegistration().registration_request()
|
||||
if max_attemp_number < 0:
|
||||
logger.warning('[AhenkDeamon] Number of Attempting for registration is over')
|
||||
|
@ -129,8 +129,9 @@ class AhenkDeamon(BaseDaemon):
|
|||
logger.error('[AhenkDeamon] Registration failed. Error message: {}'.format(str(e)))
|
||||
|
||||
def registration_failed(self):
|
||||
# TODO registration fail protocol implement
|
||||
pass
|
||||
self.logger.error('[AhenkDeamon] Registration failed. All registration attemps were failed. Ahenk is stopping...')
|
||||
print('Registration failed. Ahenk is stopping..')
|
||||
ahenkdaemon.stop()
|
||||
|
||||
def reload_plugins(self):
|
||||
Scope.getInstance().getPluginManager().reloadPlugins()
|
||||
|
|
|
@ -209,10 +209,10 @@ class Util:
|
|||
|
||||
result_code, p_out, p_err = Util.execute('dpkg -s {}'.format(package_name))
|
||||
try:
|
||||
lines=str(p_out).split('\n')
|
||||
lines = str(p_out).split('\n')
|
||||
for line in lines:
|
||||
if len(line)>1:
|
||||
if line.split(None, 1)[0].lower() =='status:':
|
||||
if len(line) > 1:
|
||||
if line.split(None, 1)[0].lower() == 'status:':
|
||||
if 'installed' in line.split(None, 1)[1].lower():
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue