public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:stage4-user-groups-fixes commit in: catalyst/base/
  2022-05-13 17:45 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Matt Turner
@ 2022-05-13 17:43 ` Matt Turner
  2022-11-20  0:21 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
  1 sibling, 0 replies; 6+ messages in thread
From: Matt Turner @ 2022-05-13 17:43 UTC (permalink / raw
  To: gentoo-commits

commit:     ae7d28b81ddc5285a210e927bec563065fda7f16
Author:     Daniel Cordero <gentoo.catalyst <AT> 0xdc <DOT> io>
AuthorDate: Thu Apr 21 07:08:23 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 13 17:41:47 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ae7d28b8

catalyst/stage4: fix handling of groups, users and keys

Previously, the set_*() functions would always set the result of the
toml parsing as the setting. Instead, only override it if it is a
string.

Fixes: 5be6069b ("catalyst: support 3 new options")
Signed-off-by: Daniel Cordero <gentoo.catalyst <AT> 0xdc.io>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 5c7e9adb..1d71c59d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -589,9 +589,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_groups(self):
         groups = self.settings["spec_prefix"] + "/groups"
         if groups in self.settings:
+            self.settings["groups"] = self.settings[groups]
             if isinstance(self.settings[groups], str):
                 self.settings["groups"] = self.settings[groups].split(",")
-            self.settings["groups"] = self.settings[groups]
             del self.settings[groups]
         else:
             self.settings["groups"] = []
@@ -600,9 +600,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_users(self):
         users = self.settings["spec_prefix"] + "/users"
         if users in self.settings:
+            self.settings["users"] = self.settings[users]
             if isinstance(self.settings[users], str):
                 self.settings["users"] = self.settings[users].split(",")
-            self.settings["users"] = self.settings[users]
             del self.settings[users]
         else:
             self.settings["users"] = []
@@ -611,9 +611,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_ssh_public_keys(self):
         ssh_public_keys = self.settings["spec_prefix"] + "/ssh_public_keys"
         if ssh_public_keys in self.settings:
+            self.settings["ssh_public_keys"] = self.settings[ssh_public_keys]
             if isinstance(self.settings[ssh_public_keys], str):
                 self.settings["ssh_public_keys"] = self.settings[ssh_public_keys].split(",")
-            self.settings["ssh_public_keys"] = self.settings[ssh_public_keys]
             del self.settings[ssh_public_keys]
         else:
             self.settings["ssh_public_keys"] = []


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/catalyst:stage4-user-groups-fixes commit in: catalyst/base/
@ 2022-05-13 17:43 Matt Turner
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Turner @ 2022-05-13 17:43 UTC (permalink / raw
  To: gentoo-commits

commit:     214bb3d849d5bf7ce2314aab1858ed6e72b28108
Author:     Daniel Cordero <gentoo.catalyst <AT> 0xdc <DOT> io>
AuthorDate: Thu Apr 21 07:08:24 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 13 17:42:15 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=214bb3d8

catalyst/stage4: don't run split on a list

"groups" has been normalised into a list and does not have a split()
method.

Fixes: 5be6069b ("catalyst: support 3 new options")
Signed-off-by: Daniel Cordero <gentoo.catalyst <AT> 0xdc.io>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 1d71c59d..7e6b9e32 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -931,7 +931,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                         env=self.env)
 
     def groups(self):
-        for x in self.settings["groups"].split():
+        for x in self.settings["groups"]:
             log.notice("Creating group: '%s'", x)
             cmd(["groupadd", "-R", self.settings['chroot_path'], x], env=self.env)
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/catalyst:stage4-user-groups-fixes commit in: catalyst/base/
  2022-05-13 17:45 [gentoo-commits] proj/catalyst:master " Matt Turner
@ 2022-05-13 17:43 ` Matt Turner
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Turner @ 2022-05-13 17:43 UTC (permalink / raw
  To: gentoo-commits

commit:     a21d590f878bf63510aa5692dd5668a56fa9f2db
Author:     Daniel Cordero <gentoo.catalyst <AT> 0xdc <DOT> io>
AuthorDate: Mon May  9 11:20:47 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 13 17:42:57 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a21d590f

catalyst/stage4: improve log message

When creating a user with no additional groups, don't print a misleading
message saying the user will be created with an equals sign in the
username.

Signed-off-by: Daniel Cordero <gentoo.catalyst <AT> 0xdc.io>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index d4875491..eb869c70 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -945,9 +945,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 log.debug("users: '=' separator not found on line " + x)
                 log.debug("users: missing separator means no groups found")
             uacmd = ["useradd", "-R", self.settings['chroot_path'], "-m", x]
+            msg_create_user = "Creating user: '%s'" % usr
             if grp != '':
                 uacmd = ["useradd", "-R", self.settings['chroot_path'], "-m", "-G", grp, usr]
-            log.notice("Creating user: '%s'", f"{usr}={grp}")
+                msg_create_user = "Creating user: '%s' in group(s): %s" % usr, grp
+            log.notice(msg_create_user)
             cmd(uacmd, env=self.env)
 
     def ssh_public_keys(self):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/catalyst:stage4-user-groups-fixes commit in: catalyst/base/
  2022-11-20  0:21 Matt Turner
@ 2022-05-13 17:43 ` Matt Turner
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Turner @ 2022-05-13 17:43 UTC (permalink / raw
  To: gentoo-commits

commit:     430a699ca9262b25fea2e8e2f0ce4eea56e6c898
Author:     Daniel Cordero <gentoo.catalyst <AT> 0xdc <DOT> io>
AuthorDate: Thu Apr 21 07:08:25 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 13 17:42:41 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=430a699c

catalyst/stage4: don't split a single entry

A single entry in users is one user who could have multiple groups.

Fixes: 5be6069b ("catalyst: support 3 new options")
Signed-off-by: Daniel Cordero <gentoo.catalyst <AT> 0xdc.io>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 7e6b9e32..d4875491 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -602,7 +602,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
         if users in self.settings:
             self.settings["users"] = self.settings[users]
             if isinstance(self.settings[users], str):
-                self.settings["users"] = self.settings[users].split(",")
+                self.settings["users"] = [self.settings[users]]
             del self.settings[users]
         else:
             self.settings["users"] = []


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/catalyst:master commit in: catalyst/base/
@ 2022-05-13 17:45 Matt Turner
  2022-05-13 17:43 ` [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner
  2022-11-20  0:21 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
  0 siblings, 2 replies; 6+ messages in thread
From: Matt Turner @ 2022-05-13 17:45 UTC (permalink / raw
  To: gentoo-commits

commit:     ae7d28b81ddc5285a210e927bec563065fda7f16
Author:     Daniel Cordero <gentoo.catalyst <AT> 0xdc <DOT> io>
AuthorDate: Thu Apr 21 07:08:23 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 13 17:41:47 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ae7d28b8

catalyst/stage4: fix handling of groups, users and keys

Previously, the set_*() functions would always set the result of the
toml parsing as the setting. Instead, only override it if it is a
string.

Fixes: 5be6069b ("catalyst: support 3 new options")
Signed-off-by: Daniel Cordero <gentoo.catalyst <AT> 0xdc.io>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 5c7e9adb..1d71c59d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -589,9 +589,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_groups(self):
         groups = self.settings["spec_prefix"] + "/groups"
         if groups in self.settings:
+            self.settings["groups"] = self.settings[groups]
             if isinstance(self.settings[groups], str):
                 self.settings["groups"] = self.settings[groups].split(",")
-            self.settings["groups"] = self.settings[groups]
             del self.settings[groups]
         else:
             self.settings["groups"] = []
@@ -600,9 +600,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_users(self):
         users = self.settings["spec_prefix"] + "/users"
         if users in self.settings:
+            self.settings["users"] = self.settings[users]
             if isinstance(self.settings[users], str):
                 self.settings["users"] = self.settings[users].split(",")
-            self.settings["users"] = self.settings[users]
             del self.settings[users]
         else:
             self.settings["users"] = []
@@ -611,9 +611,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_ssh_public_keys(self):
         ssh_public_keys = self.settings["spec_prefix"] + "/ssh_public_keys"
         if ssh_public_keys in self.settings:
+            self.settings["ssh_public_keys"] = self.settings[ssh_public_keys]
             if isinstance(self.settings[ssh_public_keys], str):
                 self.settings["ssh_public_keys"] = self.settings[ssh_public_keys].split(",")
-            self.settings["ssh_public_keys"] = self.settings[ssh_public_keys]
             del self.settings[ssh_public_keys]
         else:
             self.settings["ssh_public_keys"] = []


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/
  2022-05-13 17:45 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Matt Turner
  2022-05-13 17:43 ` [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner
@ 2022-11-20  0:21 ` Matt Turner
  1 sibling, 0 replies; 6+ messages in thread
From: Matt Turner @ 2022-11-20  0:21 UTC (permalink / raw
  To: gentoo-commits

commit:     ae7d28b81ddc5285a210e927bec563065fda7f16
Author:     Daniel Cordero <gentoo.catalyst <AT> 0xdc <DOT> io>
AuthorDate: Thu Apr 21 07:08:23 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 13 17:41:47 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ae7d28b8

catalyst/stage4: fix handling of groups, users and keys

Previously, the set_*() functions would always set the result of the
toml parsing as the setting. Instead, only override it if it is a
string.

Fixes: 5be6069b ("catalyst: support 3 new options")
Signed-off-by: Daniel Cordero <gentoo.catalyst <AT> 0xdc.io>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 5c7e9adb..1d71c59d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -589,9 +589,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_groups(self):
         groups = self.settings["spec_prefix"] + "/groups"
         if groups in self.settings:
+            self.settings["groups"] = self.settings[groups]
             if isinstance(self.settings[groups], str):
                 self.settings["groups"] = self.settings[groups].split(",")
-            self.settings["groups"] = self.settings[groups]
             del self.settings[groups]
         else:
             self.settings["groups"] = []
@@ -600,9 +600,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_users(self):
         users = self.settings["spec_prefix"] + "/users"
         if users in self.settings:
+            self.settings["users"] = self.settings[users]
             if isinstance(self.settings[users], str):
                 self.settings["users"] = self.settings[users].split(",")
-            self.settings["users"] = self.settings[users]
             del self.settings[users]
         else:
             self.settings["users"] = []
@@ -611,9 +611,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
     def set_ssh_public_keys(self):
         ssh_public_keys = self.settings["spec_prefix"] + "/ssh_public_keys"
         if ssh_public_keys in self.settings:
+            self.settings["ssh_public_keys"] = self.settings[ssh_public_keys]
             if isinstance(self.settings[ssh_public_keys], str):
                 self.settings["ssh_public_keys"] = self.settings[ssh_public_keys].split(",")
-            self.settings["ssh_public_keys"] = self.settings[ssh_public_keys]
             del self.settings[ssh_public_keys]
         else:
             self.settings["ssh_public_keys"] = []


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-20  0:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-13 17:45 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Matt Turner
2022-05-13 17:43 ` [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner
2022-11-20  0:21 ` [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2022-11-20  0:21 Matt Turner
2022-05-13 17:43 ` [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner
2022-05-13 17:45 [gentoo-commits] proj/catalyst:master " Matt Turner
2022-05-13 17:43 ` [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner
2022-05-13 17:43 Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox