Commit 9f0b1c97 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

slapos.cookbook: re6stManageToken supports python3

it seems the RPC deleteToken never returned NOT_FOUND anyway.
parent ebbbfe17
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import httplib
import logging import logging
import json import json
import os import os
...@@ -93,9 +92,6 @@ def requestRemoveToken(client, token_base_path): ...@@ -93,9 +92,6 @@ def requestRemoveToken(client, token_base_path):
reference = reference_key.split('.')[0] reference = reference_key.split('.')[0]
try: try:
result = client.deleteToken(token) result = client.deleteToken(token)
except httplib.NOT_FOUND:
# Token is alread removed.
result = True
except Exception: except Exception:
log.debug('Request delete token fail for %s... \n %s' % (request_file, log.debug('Request delete token fail for %s... \n %s' % (request_file,
traceback.format_exc())) traceback.format_exc()))
...@@ -119,7 +115,7 @@ def requestRemoveToken(client, token_base_path): ...@@ -119,7 +115,7 @@ def requestRemoveToken(client, token_base_path):
os.unlink(ipv6_file) os.unlink(ipv6_file)
else: else:
log.debug('Bad token. Request add token fail for %s...' % request_file) log.debug('Bad token. Request remove token fail for %s...' % request_file)
def checkService(client, token_base_path, token_json, computer_partition): def checkService(client, token_base_path, token_json, computer_partition):
token_dict = loadJsonFile(token_json) token_dict = loadJsonFile(token_json)
...@@ -128,7 +124,7 @@ def checkService(client, token_base_path, token_json, computer_partition): ...@@ -128,7 +124,7 @@ def checkService(client, token_base_path, token_json, computer_partition):
return return
# Check token status # Check token status
for slave_reference, token in token_dict.iteritems(): for slave_reference, token in token_dict.items():
log.info("%s %s" % (slave_reference, token)) log.info("%s %s" % (slave_reference, token))
status_file = os.path.join(token_base_path, '%s.status' % slave_reference) status_file = os.path.join(token_base_path, '%s.status' % slave_reference)
if not os.path.exists(status_file): if not os.path.exists(status_file):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment