Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DB Upgrade Python Script
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
archana
DB Upgrade Python Script
Commits
4c6f6083
Commit
4c6f6083
authored
Jul 30, 2021
by
archana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fic: updated constant update logic
parent
cf8fef09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
scripts/handler/update_handler.py
scripts/handler/update_handler.py
+10
-3
No files found.
scripts/handler/update_handler.py
View file @
4c6f6083
from
scripts.db.mongo
import
mongo_client
from
scripts.db.mongo.collections.constants
import
Constants
from
scripts.logging.logger
import
logger
from
scripts.db.mongo
import
mongo_client
class
UpdateHandler
:
...
...
@@ -14,9 +14,16 @@ class UpdateHandler:
data
=
constants_records
.
get
(
"data"
)
for
each
in
data
:
if
each
.
get
(
"key_list"
):
each
.
update
({
"access_list"
:
each
.
get
(
"key_list"
)[:
-
1
]})
try
:
target_index
=
each
.
get
(
"key_list"
)
.
index
(
"equipment"
)
except
ValueError
as
e
:
logger
.
debug
(
"Equipment Index not found"
)
target_index
=
None
final_list
=
each
.
get
(
"key_list"
)[:
target_index
]
each
.
update
({
"access_key_list"
:
final_list
})
print
(
data
)
logger
.
debug
(
f
'constant data: {data}'
)
# self.constants_mongo.update_one(query={"type":"site_template"},data={"data":
data})
self
.
constants_mongo
.
update_one
(
query
=
{
"type"
:
"site_template"
},
data
=
{
"data"
:
data
})
status
=
True
return
status
except
Exception
as
e
:
...
...
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