def get_ssh_key(host, username, password, protocol=None, port=None, certificate_verify=False):
 if (protocol is None):
  protocol = 'https'
 if (port is None):
  port = 443
 url = '{0}://{1}:{2}/host/ssh_root_authorized_keys'.format(protocol, host, port)
 ret = {}
 try:
  result = salt.utils.http.query(url, status=True, text=True, method='GET', username=username, password=password, verify_ssl=certificate_verify)
  if (result.get('status') == 200):
   ret['status'] = True
   ret['key'] = result['text']
  else:
   ret['status'] = False
   ret['Error'] = result['error']
 except Exception as msg:
  ret['status'] = False
  ret['Error'] = msg
 return ret

def get_ssh_key ( host , username , password , protocol = None , port = None , certificate_verify = False ) : if ( protocol is None ) : protocol = 'https' if ( port is None ) : port = 443 url = '{0}://{1}:{2}/host/ssh_root_authorized_keys' . format ( protocol , host , port ) ret = { } try : result = salt . utils . http . query ( url , status = True , text = True , method = 'GET' , username = username , password = password , verify_ssl = certificate_verify ) if ( result . get ( 'status' ) == 200 ) : ret [ 'status' ] = True ret [ 'key' ] = result [ 'text' ] else : ret [ 'status' ] = False ret [ 'Error' ] = result [ 'error' ] except Exception as msg : ret [ 'status' ] = False ret [ 'Error' ] = msg return ret
retrieve the authorized_keys entry for root .