EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Data Handling
core
Commits
bbfae98a
Commit
bbfae98a
authored
2 years ago
by
Lubomir Dolezal
Browse files
Options
Downloads
Patches
Plain Diff
fix: regression caused by setting replace as a boolean flag
now possible to override
parent
84084f29
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#26850
passed
2 years ago
Stage: test
Stage: publish
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
registrar/cli.py
+33
-9
33 additions, 9 deletions
registrar/cli.py
with
33 additions
and
9 deletions
registrar/cli.py
+
33
−
9
View file @
bbfae98a
...
...
@@ -91,9 +91,18 @@ def cli(
@cli.command
(
help
=
"
Run the registrar daemon, attaching to a Redis queue
"
)
@click.option
(
"
--replace/--no-replace
"
,
default
=
None
)
@click.option
(
"
--replace
"
,
default
=
None
,
help
=
"
Override config
'
replace
'
of all routes to
'
True
'"
,
)
@click.option
(
"
--no-replace
"
,
default
=
None
,
help
=
"
Override config
'
replace
'
of all routes to
'
False
'"
,
)
@click.pass_context
def
daemon
(
ctx
,
replace
=
Fals
e
):
def
daemon
(
ctx
,
replace
,
no_replac
e
):
"""
Run the registrar daemon to listen on the given queues
and execute the (de-)registrations commands.
...
...
@@ -111,9 +120,13 @@ def daemon(ctx, replace=False):
config
:
RegistrarConfig
=
ctx
.
obj
[
"
CONFIG
"
]
if
replace
is
not
None
:
# allow to override config values from CLI
if
replace
:
for
route
in
config
.
routes
.
values
():
route
.
replace
=
replace
route
.
replace
=
True
elif
no_replace
:
for
route
in
config
.
routes
.
values
():
route
.
replace
=
False
run_daemon
(
config
)
...
...
@@ -121,9 +134,18 @@ def daemon(ctx, replace=False):
@cli.command
(
help
=
"
Run a single, one-off registration
"
)
@click.argument
(
"
route_name
"
,
type
=
str
)
@click.argument
(
"
item
"
,
type
=
str
)
@click.option
(
"
--replace/--no-replace
"
,
is_flag
=
True
)
@click.option
(
"
--replace
"
,
default
=
None
,
help
=
"
Override config
'
replace
'
of route to
'
True
'"
,
)
@click.option
(
"
--no-replace
"
,
default
=
None
,
help
=
"
Override config
'
replace
'
of route to
'
False
'"
,
)
@click.pass_context
def
register
(
ctx
,
route_name
,
item
,
replace
):
def
register
(
ctx
,
route_name
,
item
,
replace
,
no_
replace
):
"""
Registers a single item.
Examples:
...
...
@@ -137,9 +159,11 @@ def register(ctx, route_name, item, replace):
register --replace myroute
"
{...}
"
"""
config
:
RegistrarConfig
=
ctx
.
obj
[
"
CONFIG
"
]
if
replace
is
not
None
:
for
route
in
config
.
routes
.
values
():
route
.
replace
=
replace
# allow to override config values from CLI
if
replace
:
config
.
routes
[
route_name
].
replace
=
True
elif
no_replace
:
config
.
routes
[
route_name
].
replace
=
False
registrar
.
register
(
config
.
routes
[
route_name
],
config
.
sources
,
item
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment