Exemplo n.º 1
0
def main():
    url = None
    if len(sys.argv) > 1:
        url = sys.argv[1]
    auth = MaasAuth(api_url=url)
    auth.get_api_key('root')
    maas_client = MaasClient(auth)

    pprint.pprint(maas_client.nodes)
Exemplo n.º 2
0
def connect_to_maas(creds=None):
    if creds:
        api_host = creds['api_host']
        api_url = 'http://{}/MAAS/api/1.0'.format(api_host)
        api_key = creds['api_key']
        auth = MaasAuth(api_url=api_url, api_key=api_key)
    else:
        auth = MaasAuth()
        auth.get_api_key('root')
    maas = MaasClient(auth)
    maas_state = MaasState(maas)
    return maas, maas_state
def connect_to_maas(creds=None):
    if creds:
        api_host = creds["api_host"]
        api_url = "http://{}/MAAS/api/1.0".format(api_host)
        api_key = creds["api_key"]
        auth = MaasAuth(api_url=api_url, api_key=api_key)
    else:
        auth = MaasAuth()
        auth.get_api_key("root")
    maas = MaasClient(auth)
    maas_state = MaasState(maas)
    return maas, maas_state
Exemplo n.º 4
0
def main():
    url = None
    if len(sys.argv) == 3:
        url = sys.argv[1]
        key = sys.argv[2]
        auth = MaasAuth(api_url=url, api_key=key)
    else:
        auth = MaasAuth(api_url=url)
        auth.get_api_key('root')
    maas_client = MaasClient(auth)
    pprint.pprint(maas_client.nodes)
    pprint.pprint(maas_client.get_server_config('maas_name'))
    pprint.pprint(maas_client.server_hostname)
Exemplo n.º 5
0
 def authenticate_maas(self):
     if self.config.maas_creds:
         api_host = self.config.maas_creds['api_host']
         api_url = 'http://{}/MAAS/api/1.0/'.format(api_host)
         api_key = self.config.maas_creds['api_key']
         auth = MaasAuth(api_url=api_url,
                         api_key=api_key)
     else:
         auth = MaasAuth()
         auth.get_api_key('root')
     self.maas = MaasClient(auth)
     self.maas_state = MaasState(self.maas)
     log.debug('Authenticated against maas api.')
Exemplo n.º 6
0
 def authenticate_maas(self):
     auth = MaasAuth()
     auth.get_api_key('root')
     self.maas = MaasClient(auth)
     self.maas_state = MaasState(self.maas)
     log.debug('Authenticated against maas api.')
Exemplo n.º 7
0
 def authenticate_maas(self):
     auth = MaasAuth()
     auth.get_api_key('root')
     self.maas = MaasClient(auth)
     self.maas_state = MaasState(self.maas)
     log.debug('Authenticated against maas api.')