Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
c6934b25
Commit
c6934b25
authored
Oct 10, 2017
by
LE GAC Renaud
Browse files
Update fix_harvesters_collection to add a protection.
parent
60fa303d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
scripts/fix_harvesters_collections.py
scripts/fix_harvesters_collections.py
+15
-13
No files found.
scripts/fix_harvesters_collections.py
View file @
c6934b25
...
...
@@ -39,19 +39,21 @@ if __name__ == "__main__":
collections
=
row
.
collections
if
row
.
host
==
"cds.cern.ch"
and
","
in
collections
:
print
"
\n\t
split:"
,
collections
data
=
row
.
as_dict
()
del
data
[
"id"
]
# insert new harvesters
for
elt
in
collections
.
split
(
","
):
print
"
\t\t
insert →"
,
elt
.
strip
()
data
[
"collections"
]
=
elt
.
strip
()
db
.
harvesters
.
insert
(
**
data
)
# delete old harvesters
print
"
\t\t
delete →"
,
row
.
id
del
db
.
harvesters
[
row
.
id
]
rep
=
raw_input
(
"
\n\t
Split '%s'? [y/N]: "
%
collections
)
if
rep
==
"y"
:
print
"
\n\t
split:"
,
collections
data
=
row
.
as_dict
()
del
data
[
"id"
]
# insert new harvesters
for
elt
in
collections
.
split
(
","
):
print
"
\t\t
insert →"
,
elt
.
strip
()
data
[
"collections"
]
=
elt
.
strip
()
db
.
harvesters
.
insert
(
**
data
)
# delete old harvesters
print
"
\t\t
delete →"
,
row
.
id
del
db
.
harvesters
[
row
.
id
]
# commit change
rep
=
raw_input
(
"Commit database changes [y/N]: "
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment