Skip to content

Commit

Permalink
remove code about authkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
小飞熊 authored and 小飞熊 committed May 3, 2018
1 parent 5c32b4a commit ea80a57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/ansible_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Config(object):

dir_script = ''
dir_playbook = ''
dir_authkeys = ''

def __init__(self):
cf = ConfigParser.ConfigParser()
Expand Down Expand Up @@ -61,8 +60,6 @@ def __init__(self):
self.dir_script = cf.get('directory', 'script')
if (cf.has_option('directory', 'playbook')):
self.dir_playbook = cf.get('directory', 'playbook')
if (cf.has_option('directory', 'authkeys')):
self.dir_authkeys = cf.get('directory', 'authkeys')

@staticmethod
def Get(attr):
Expand Down
9 changes: 3 additions & 6 deletions src/ansible_api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class FileList(Controller):
def get(self):
path = self.get_argument('type', 'script')
sign = self.get_argument('sign', '')
allows = ['script', 'playbook', 'authkeys']
allows = ['script', 'playbook']
if path in allows:
hotkey = path + Config.Get('sign_key')
check_str = Tool.getmd5(hotkey)
Expand Down Expand Up @@ -192,7 +192,7 @@ def get(self):
path = self.get_argument('type', 'script')
file_name = self.get_argument('name')
sign = self.get_argument('sign', '')
allows = ['script', 'playbook', 'authkeys']
allows = ['script', 'playbook']
if path in allows:
hotkey = path + file_name + Config.Get('sign_key')
check_str = Tool.getmd5(hotkey)
Expand Down Expand Up @@ -232,7 +232,7 @@ def post(self):
content = data['c'].encode('utf-8').decode()
sign = data['s']
if not filename or not content or not sign or path \
not in ['script', 'playbook', 'authkeys']:
not in ['script', 'playbook']:
self.write(Tool.jsonal(
{'error': "Lack of necessary parameters", 'rc': ErrorCode.ERRCODE_SYS}))
hotkey = path + filename + Config.Get('sign_key')
Expand All @@ -242,9 +242,6 @@ def post(self):
{'error': "Sign is error", 'rc': ErrorCode.ERRCODE_BIZ}))
else:
file_path = Config.Get('dir_' + path) + filename
if path == 'authkeys': # allow mkdir in this mode
dir_name = os.path.dirname(file_path)
os.path.isdir(dir_name) == False and os.mkdir(dir_name)
result = yield executor.submit(self.write_file, file_path, content)
self.write(Tool.jsonal({'ret': result}))

Expand Down

0 comments on commit ea80a57

Please sign in to comment.