From 693c8970e4fbe5cfd6e6957050686eddb00c2212 Mon Sep 17 00:00:00 2001
From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
Date: Wed, 15 Jan 2025 16:15:35 +0000
Subject: [PATCH 1/3] Fix AttributeError: 'Authorization' object has no
attribute 'log' (#660)
---
changes.d/660.fix.md | 1 +
cylc/uiserver/app.py | 2 +-
cylc/uiserver/authorise.py | 6 +++---
cylc/uiserver/tests/test_authorise.py | 20 ++++++++++++++++++++
4 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 changes.d/660.fix.md
diff --git a/changes.d/660.fix.md b/changes.d/660.fix.md
new file mode 100644
index 00000000..c1bc13f9
--- /dev/null
+++ b/changes.d/660.fix.md
@@ -0,0 +1 @@
+Fixed crash when starting the UI Server if a user has invalid groups in their profile.
diff --git a/cylc/uiserver/app.py b/cylc/uiserver/app.py
index afe9aa3c..9914268a 100644
--- a/cylc/uiserver/app.py
+++ b/cylc/uiserver/app.py
@@ -592,7 +592,7 @@ def set_auth(self) -> Authorization:
getpass.getuser(),
user_auth,
site_auth,
- self.log,
+ log=self.log,
)
def initialize_templates(self):
diff --git a/cylc/uiserver/authorise.py b/cylc/uiserver/authorise.py
index c45a1df5..9333c845 100644
--- a/cylc/uiserver/authorise.py
+++ b/cylc/uiserver/authorise.py
@@ -165,12 +165,12 @@ def __init__(
log,
):
self.owner_user_name: str = owner_user_name
- self.owner_user_groups: List[str] = self._get_groups(
- self.owner_user_name
- )
self.log = log
self.owner_auth_conf: dict = owner_auth_conf
self.site_auth_config: dict = site_auth_conf
+ self.owner_user_groups: List[str] = self._get_groups(
+ self.owner_user_name
+ )
self.owner_dict = self.build_owner_site_auth_conf()
# lru_cache this method - see flake8-bugbear B019
diff --git a/cylc/uiserver/tests/test_authorise.py b/cylc/uiserver/tests/test_authorise.py
index bb1da22b..c751ffb7 100644
--- a/cylc/uiserver/tests/test_authorise.py
+++ b/cylc/uiserver/tests/test_authorise.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+import inspect
import logging
from types import SimpleNamespace
from unittest.mock import Mock, patch
@@ -476,3 +477,22 @@ def test_empty_list_in_config():
auth_obj = Authorization('me', {}, {'*': {'me': {'default': []}}}, LOG)
with pytest.raises(Exception, match='Error in site config'):
auth_obj.return_site_auth_defaults_for_access_user('me', ['x'])
+
+
+def test_Authorization_logging(monkeypatch: pytest.MonkeyPatch):
+ """Test logging doesn't fall over spectacularly during __init__()."""
+ # Patch all methods to call self.log:
+ for name, method in inspect.getmembers(
+ Authorization, predicate=inspect.isfunction
+ ):
+ if (
+ not name.startswith('__') and
+ inspect.signature(method).parameters.get('self')
+ ):
+ monkeypatch.setattr(
+ Authorization,
+ name,
+ lambda self, *a, **k: self.log.info('foo'),
+ )
+ # Test:
+ Authorization('brian', {}, {}, log=Mock())
From 3b350c435597ad30704575d2684665e5ce59b756 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 15 Jan 2025 16:27:05 +0000
Subject: [PATCH 2/3] Prepare release 1.6.1
Workflow: Release stage 1 - create release PR, run: 32
---
CHANGES.md | 10 ++++++++++
changes.d/660.fix.md | 1 -
changes.d/661.feat.md | 1 -
cylc/uiserver/__init__.py | 2 +-
4 files changed, 11 insertions(+), 3 deletions(-)
delete mode 100644 changes.d/660.fix.md
delete mode 100644 changes.d/661.feat.md
diff --git a/CHANGES.md b/CHANGES.md
index b014bf00..5634418a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,16 @@ $ towncrier create ..md --content "Short description"
+## cylc-uiserver-1.6.1 (Released 2025-01-15)
+
+### 🚀 Enhancements
+
+[#661](https://github.com/cylc/cylc-uiserver/pull/661) - The GUI can now be launched in standalone mode even if `[hub]url` is configured, using the `--new` option.
+
+### 🔧 Fixes
+
+[#660](https://github.com/cylc/cylc-uiserver/pull/660) - Fixed crash when starting the UI Server if a user has invalid groups in their profile.
+
## cylc-uiserver-1.6.0 (Released 2025-01-08)
[Updated cylc-ui to 2.7.0](https://github.com/cylc/cylc-ui/blob/master/CHANGES.md)
diff --git a/changes.d/660.fix.md b/changes.d/660.fix.md
deleted file mode 100644
index c1bc13f9..00000000
--- a/changes.d/660.fix.md
+++ /dev/null
@@ -1 +0,0 @@
-Fixed crash when starting the UI Server if a user has invalid groups in their profile.
diff --git a/changes.d/661.feat.md b/changes.d/661.feat.md
deleted file mode 100644
index 62fa704b..00000000
--- a/changes.d/661.feat.md
+++ /dev/null
@@ -1 +0,0 @@
-The GUI can now be launched in standalone mode even if `[hub]url` is configured, using the `--new` option.
diff --git a/cylc/uiserver/__init__.py b/cylc/uiserver/__init__.py
index 7f0632fd..550adbbd 100644
--- a/cylc/uiserver/__init__.py
+++ b/cylc/uiserver/__init__.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-__version__ = "1.6.1.dev"
+__version__ = "1.6.1"
import os
from typing import Dict
From a5ba347cf84bfa6ab9c2ad5c57dc48d848c52ab6 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 15 Jan 2025 16:43:03 +0000
Subject: [PATCH 3/3] Bump dev version
Workflow: Release stage 2 - auto publish, run: 61
---
cylc/uiserver/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cylc/uiserver/__init__.py b/cylc/uiserver/__init__.py
index 550adbbd..15ca2757 100644
--- a/cylc/uiserver/__init__.py
+++ b/cylc/uiserver/__init__.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-__version__ = "1.6.1"
+__version__ = "1.6.2.dev"
import os
from typing import Dict