maas-cli 登录始终返回 403 Forbidden

maas-cli 登录始终返回 403 Forbidden

我有一个测试设置,其中运行着一个 MaaS 服务器、一个 JuJu 服务器和 MaaS 集群中的多个节点。

在我用 Saucy 而不是 Precise 重新安装了 MaaS 服务器(以及随后的 JuJu-Core 服务器)之后,某些事情确实得到了改善,但至少还有一件事现在似乎被破坏了。maas-cli我总是收到错误:

httplib2.socks.HTTPError, 403, Forbidden.

我还创建了一个新的 MaaS Key/OAuthToken,但无济于事。我有几台机器,集群中的磁盘数量不同。但它们的 CPU 数量和内存量相同。根据这个关于 Juju 符咒限制的文章

我还可以在部署过程中使用标签作为约束来区分节点。由于我似乎无法通过 MaaS Web UI 标记节点,所以我想使用maas-cli。在 precise 上它运行良好,我用它来发布节点等。但在 Saucy 上我甚至一次都无法登录。我总是得到:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/maascli/__main__.py", line 20, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/maascli/__init__.py", line 46, in main
    options.execute(options)
  File "/usr/lib/python2.7/dist-packages/maascli/cli.py", line 70, in __call__
    description = fetch_api_description(options.url, options.insecure)
  File "/usr/lib/python2.7/dist-packages/maascli/api.py", line 71, in fetch_api_description
    ascii_url(url_describe), "GET", insecure=insecure)
  File "/usr/lib/python2.7/dist-packages/maascli/api.py", line 60, in http_request
    return http.request(url, method, body=body, headers=headers)
  File "/usr/lib/python2.7/dist-packages/httplib2/__init__.py", line 1569, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/python2.7/dist-packages/httplib2/__init__.py", line 1316, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python2.7/dist-packages/httplib2/__init__.py", line 1251, in _conn_request
    conn.connect()
  File "/usr/lib/python2.7/dist-packages/httplib2/__init__.py", line 900, in connect
    self.sock.connect((self.host, self.port) + sa[2:])
  File "/usr/lib/python2.7/dist-packages/httplib2/socks.py", line 424, in connect
    self.__negotiatehttp(destpair[0], destpair[1])
  File "/usr/lib/python2.7/dist-packages/httplib2/socks.py", line 390, in __negotiatehttp
    raise HTTPError((statuscode, statusline[2]))
httplib2.socks.HTTPError: (403, 'Forbidden')

maas.log 中没有关于此问题的任何内容。它包含有关 OAuth 的错误消息以及请求未经授权的消息。但这是一条“旧”消息。似乎没有新消息写入该日志。

ERROR 2013-11-22 09:35:37,592 maasserver Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 128, in __call__
    actor, anonymous = self.authenticate(request, rm)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 103, in authenticate
    if not authenticator.is_authenticated(request):
  File "/usr/lib/python2.7/dist-packages/maasserver/api_auth.py", line 57, in is_authenticated
    raise OAuthUnauthorized(error)
OAuthUnauthorized

我该如何解决这个问题?

答案1

回答我自己的问题,它是http-proxy/https-proxy环境变量。

由于我使用私有 IP 进行 POC,因此我必须设置http-proxy/https-proxy环境变量。特别是因为maas-import-pxe-files需要这个。

相关内容