diff --git a/pkg/docker/entrypoint.sh b/pkg/docker/entrypoint.sh index cb22c555f48..26647758456 100755 --- a/pkg/docker/entrypoint.sh +++ b/pkg/docker/entrypoint.sh @@ -70,9 +70,9 @@ if [ ! -f /var/lib/pgadmin/pgadmin4.db ]; then # When running in Desktop mode, no user is created # so we have to import servers anonymously if [ "${PGADMIN_CONFIG_SERVER_MODE}" = "False" ]; then - /venv/bin/python3 /pgadmin4/setup.py --load-servers "${PGADMIN_SERVER_JSON_FILE}" + /venv/bin/python3 /pgadmin4/setup.py load-servers "${PGADMIN_SERVER_JSON_FILE}" else - /venv/bin/python3 /pgadmin4/setup.py --load-servers "${PGADMIN_SERVER_JSON_FILE}" --user "${PGADMIN_DEFAULT_EMAIL}" + /venv/bin/python3 /pgadmin4/setup.py load-servers "${PGADMIN_SERVER_JSON_FILE}" --user "${PGADMIN_DEFAULT_EMAIL}" fi fi fi diff --git a/web/pgadmin/browser/server_groups/__init__.py b/web/pgadmin/browser/server_groups/__init__.py index 31fd43f12fe..9738a205812 100644 --- a/web/pgadmin/browser/server_groups/__init__.py +++ b/web/pgadmin/browser/server_groups/__init__.py @@ -185,7 +185,7 @@ def delete(self, gid): # This matches the behavior of # web/pgadmin/utils/__init.py__#clear_database_servers # called by the setup script when importing and replacing servers: - # `python setup.py --load-servers input_file.json --replace` + # `python setup.py load-servers input_file.json --replace` sg = groups.first() shared_servers = Server.query.filter_by(servergroup_id=gid, diff --git a/web/pgadmin/setup/tests/test_export_import_servers.py b/web/pgadmin/setup/tests/test_export_import_servers.py index 6c00841afb1..f3bbc33debe 100644 --- a/web/pgadmin/setup/tests/test_export_import_servers.py +++ b/web/pgadmin/setup/tests/test_export_import_servers.py @@ -36,13 +36,13 @@ def runTest(self): # Load the servers os.system( - "python \"%s\" --load-servers \"%s\" 2> %s" % + "python \"%s\" load-servers \"%s\" 2> %s" % (setup, os.path.join(path, "servers.json"), os.devnull) ) # And dump them again tf = tempfile.NamedTemporaryFile(delete=False) - os.system("python \"%s\" --dump-servers \"%s\" 2> %s" % + os.system("python \"%s\" dump-servers \"%s\" 2> %s" % (setup, tf.name, os.devnull)) # Compare the JSON files, ignoring servers that exist in our diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py index 8a15148c3f1..477547b60cc 100644 --- a/web/pgadmin/utils/__init__.py +++ b/web/pgadmin/utils/__init__.py @@ -457,7 +457,9 @@ def dump_database_servers(output_file, selected_servers, servers = Server.query.filter_by(user_id=user_id).all() server_dict = {} for server in servers: - if selected_servers is None or str(server.id) in selected_servers: + if selected_servers is None or (type(selected_servers) == list + and len(selected_servers) == 0 + ) or str(server.id) in selected_servers: # Get the group name group_name = ServerGroup.query.filter_by( user_id=user_id, id=server.servergroup_id).first().name