Skip to content
Snippets Groups Projects
Commit 08dcdedf authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[scripts.settings] Be more flexible with group discovery

parent 842965eb
No related branches found
No related tags found
No related merge requests found
Pipeline #57060 passed
...@@ -20,7 +20,7 @@ logger = get_logger(__name__) ...@@ -20,7 +20,7 @@ logger = get_logger(__name__)
def _change_settings(project, info, dry_run): def _change_settings(project, info, dry_run):
"""Updates the project settings using ``info``""" """Updates the project settings using ``info``"""
name = f"{project.namespace['name']}/{project.name}" name = f"{project.namespace['full_path']}/{project.name}"
echo_normal(f"Changing {name}...") echo_normal(f"Changing {name}...")
if info.get("archive") is not None: if info.get("archive") is not None:
...@@ -76,6 +76,12 @@ Examples: ...@@ -76,6 +76,12 @@ Examples:
type=str, type=str,
help="Set this to update the project description", help="Set this to update the project description",
) )
@click.option(
"-g",
"--group/--no-group",
default=False,
help="If set, consider the the provided name as a group name",
)
@click.option( @click.option(
"-A", "-A",
"--archive/--unarchive", "--archive/--unarchive",
...@@ -92,7 +98,7 @@ Examples: ...@@ -92,7 +98,7 @@ Examples:
) )
@verbosity_option() @verbosity_option()
@bdt.raise_on_error @bdt.raise_on_error
def settings(projects, avatar, description, archive, dry_run): def settings(projects, avatar, description, group, archive, dry_run):
"""Updates project settings""" """Updates project settings"""
# if we are in a dry-run mode, let's let it be known # if we are in a dry-run mode, let's let it be known
...@@ -105,12 +111,12 @@ def settings(projects, avatar, description, archive, dry_run): ...@@ -105,12 +111,12 @@ def settings(projects, avatar, description, archive, dry_run):
for target in projects: for target in projects:
if "/" in target: # it is a specific project if os.path.exists(target): # it is a file with project names
gl_projects.append(_get_project(gl, target))
elif os.path.exists(target): # it is a file with project names
gl_projects += _get_projects_from_file(gl, target) gl_projects += _get_projects_from_file(gl, target)
if not group: # it is a specific project
gl_projects.append(_get_project(gl, target))
else: # it is a group - get all projects else: # it is a group - get all projects
gl_projects += _get_projects_from_group(gl, target) gl_projects += _get_projects_from_group(gl, target)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment