[elbe-devel] [PATCH 3/8] elbepack: db: remove add_user()

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Aug 13 13:31:51 CEST 2024


The usermanagement of elbe is being removed.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 bash-completion                |  2 +-
 docs/elbe-control.rst          |  5 -----
 docs/elbe-db.rst               | 23 -----------------------
 elbepack/commands/control.py   | 19 -------------------
 elbepack/commands/db.py        | 17 -----------------
 elbepack/daemons/soap/esoap.py |  7 -------
 6 files changed, 1 insertion(+), 72 deletions(-)

diff --git a/bash-completion b/bash-completion
index 3682917fc60c..1f22944962bd 100644
--- a/bash-completion
+++ b/bash-completion
@@ -106,7 +106,7 @@ _cmd_args_completion_elbe()
             control)
                 file_arg=true
                 disable_space=true
-                cmd_opt=$(_elbe_subcmd_with_opt 'rm_log list_projects list_users add_user create_project reset_project \
+                cmd_opt=$(_elbe_subcmd_with_opt 'rm_log list_projects list_users create_project reset_project \
                                                  del_project set_xml build build_sysroot build_sdk build_cdroms get_file \
                                                  build_chroot_tarball dump_file get_files wait_busy set_cdrom set_orig \
 						 set_pdebuild build_pbuilder update_pbuilder')
diff --git a/docs/elbe-control.rst b/docs/elbe-control.rst
index 7bd05a7d1fcc..32a672243456 100644
--- a/docs/elbe-control.rst
+++ b/docs/elbe-control.rst
@@ -154,11 +154,6 @@ a ./debian folder with a valid debianization.
 *list_users*
    List configured users. Only admins may use this command.
 
-*add_user* <name> <fullname> <password> <email>
-   Create a user inside the initvm. The user is not an Admin user. When
-   the user already exists, nothing is done. Only admins may use this
-   command.
-
 *wait_busy* <build-dir>
    Wait, while <build-dir> is busy.
 
diff --git a/docs/elbe-db.rst b/docs/elbe-db.rst
index 3d9782fd52f4..bb995995f254 100644
--- a/docs/elbe-db.rst
+++ b/docs/elbe-db.rst
@@ -23,7 +23,6 @@ SYNOPSIS
       elbe db [options] print_version_xml <project_dir> <version>
       elbe db [options] init
       elbe db [options] set_project_version <project_dir> <version>
-      elbe db [options] add_user <username>
       elbe db [options] list_versions <project_dir>
       elbe db [options] del_versions <project_dir> <version>
       elbe db [options] build <project_dir>
@@ -39,25 +38,6 @@ OPTIONS
 -h, --help
    Displays help.
 
---name
-   Sets the name of the new user.
-
---fullname
-   Sets the full name of the new user.
-
---password
-   Sets the password of the new user.
-
---email
-   Sets the email address of the new user.
-
---noadmin
-   TODO!! MACHT MEINER MEINUNG NACH DAS GLEICHE WIE ADMIN.
-
---admin
-   Gives the new user admin privileges. (Boolean variable,
-   default=False).
-
 --user
    User name of the project owner.
 
@@ -76,9 +56,6 @@ COMMANDS
    name[=root], fullname[=Admin], password[=foo],
    email[=\ root at localhost], noadmin[=True].
 
-*add_user* <username>
-   Adds a new user. Options: fullname, password, email, admin=[False].
-
 *list_projects*
    Lists all projects stored in the database.
 
diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index 5df449b59bd4..a502cdcaba0d 100644
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -45,24 +45,6 @@ def _list_users(client, args):
         print(u)
 
 
- at add_argument('name')
- at add_argument('fullname')
- at add_argument('password')
- at add_argument('email')
-def _add_user(client, args):
-    try:
-        client.service.add_user(args.name, args.fullname, args.password, args.email, False)
-    except WebFault as e:
-        if not hasattr(e.fault, 'faultstring'):
-            raise
-
-        if not e.fault.faultstring.endswith('already exists in the database'):
-            raise
-
-        # when we get here, the user we wanted to create already exists.
-        # that is fine, and we dont need to do anything now.
-
-
 def _create_project(client, args):
     uuid = client.service.new_project()
     print(uuid)
@@ -220,7 +202,6 @@ _client_actions = {
     'rm_log':               _remove_log,
     'list_projects':        _list_projects,
     'list_users':           _list_users,
-    'add_user':             _add_user,
     'create_project':       _create_project,
     'reset_project':        _reset_project,
     'del_project':          _delete_project,
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index 2c2002fe4f34..374b7346aff6 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -4,7 +4,6 @@
 
 import argparse
 import sys
-from getpass import getpass
 from shutil import copyfileobj
 
 from elbepack.cli import add_argument, add_arguments_from_decorated_function
@@ -21,21 +20,6 @@ def _init(args):
                    args.email, args.admin)
 
 
- at add_argument('--fullname')
- at add_argument('--password')
- at add_argument('--email')
- at add_argument('--admin', default=False, action='store_true')
- at add_argument('username')
-def _add_user(args):
-    if not args.password:
-        password = getpass('Password for the new user: ')
-    else:
-        password = args.password
-
-    db = ElbeDB()
-    db.add_user(args.username, args.fullname, password, args.email, args.admin)
-
-
 def _list_projects(args):
     db = ElbeDB()
     projects = db.list_projects()
@@ -153,7 +137,6 @@ def _print_version_xml(args):
 
 _actions = {
     'init':                _init,
-    'add_user':            _add_user,
     'list_projects':       _list_projects,
     'list_users':          _list_users,
     'create_project':      _create_project,
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index e6e0d1766e5e..2c9f73717a12 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -49,13 +49,6 @@ class ESoap (ServiceBase):
     def list_users(self):
         return [u.name for u in self.app.pm.db.list_users()]
 
-    @rpc(String, String, String, String, Boolean)
-    @soap_faults
-    @authenticated_admin
-    def add_user(self, name, fullname, password, email, admin):
-
-        self.app.pm.db.add_user(name, fullname, password, email, admin)
-
     @rpc(_returns=Array(SoapProject))
     @soap_faults
     @authenticated_admin

-- 
2.46.0



More information about the elbe-devel mailing list