Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth tidy #613

Merged
merged 8 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cylc/uiserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,15 @@ def set_sub_server(self):
auth=self.authobj,
)

def set_auth(self):
def set_auth(self) -> Authorization:
"""Create authorization object.
One for the lifetime of the UIServer.
"""
return Authorization(
getpass.getuser(),
self.config.CylcUIServer.user_authorization,
self.config.CylcUIServer.site_authorization,
self.log
self.config.CylcUIServer.user_authorization.to_dict(),
self.config.CylcUIServer.site_authorization.to_dict(),
Comment on lines -551 to +552
Copy link
Member

@MetRonnie MetRonnie Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just pulled and now getting an error when accessing cylc hub

[W 2024-07-12 14:51:13.403 CylcHubApp manager:363] cylc.uiserver | extension failed loading with message: AttributeError("'dict' object has no attribute 'to_dict'")
    Traceback (most recent call last):
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 359, in load_extension
        extension.load_all_points(self.serverapp)
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 231, in load_all_points
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 231, in <listcomp>
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 222, in load_point
        return point.load(serverapp)
               ^^^^^^^^^^^^^^^^^^^^^
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 150, in load
        return loader(serverapp)
               ^^^^^^^^^^^^^^^^^
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 474, in _load_jupyter_server_extension
        extension.initialize()
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 436, in initialize
        self._prepare_handlers()
      File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 326, in _prepare_handlers
        self.initialize_handlers()
      File "~/github/cylc-uiserver/cylc/uiserver/app.py", line 464, in initialize_handlers
        self.authobj = self.set_auth()
                       ^^^^^^^^^^^^^^^
      File "~/github/cylc-uiserver/cylc/uiserver/app.py", line 552, in set_auth
        self.config.CylcUIServer.site_authorization.to_dict(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'dict' object has no attribute 'to_dict'

In our site config, c.CylcUIServer.site_authorization is a dict

Copy link
Member Author

@oliver-sanders oliver-sanders Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't see a case where this would be a dict, no I know.

I have no idea why using the hub would cause the configuration object to differ, but an easy fix.

self.log,
)

def initialize_templates(self):
Expand Down
Loading