Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
managementhost
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DeployIT
managementhost
Commits
ee2d1d5e
Commit
ee2d1d5e
authored
10 years ago
by
Rafael Ostertag
Browse files
Options
Downloads
Patches
Plain Diff
method field in log database not required anymore.
added method to update method field.
parent
2db20c02
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
managementhost/database.py
+19
-7
19 additions, 7 deletions
managementhost/database.py
with
19 additions
and
7 deletions
managementhost/database.py
+
19
−
7
View file @
ee2d1d5e
...
...
@@ -50,14 +50,14 @@ class Database(object):
def
add_log
(
self
,
uuid
,
submitted
,
origin
,
module
,
module_version
,
module_path
,
method
,
message
):
message
):
try
:
host_module
=
self
.
_get_host_module
(
module
,
module_version
)
if
host_module
is
None
:
self
.
_create_host_module
(
module
,
module_version
,
module_path
)
host_module
=
self
.
_get_host_module
(
module
,
module_version
)
self
.
_create_log
(
uuid
,
submitted
,
origin
,
host_module
[
0
],
method
,
message
)
self
.
_create_log
(
uuid
,
submitted
,
origin
,
host_module
[
0
],
message
)
except
Exception
as
ex
:
logger
.
error
(
'
Error while adding log to database: %s
'
,
str
(
ex
))
self
.
connection
.
rollback
()
...
...
@@ -65,6 +65,18 @@ class Database(object):
self
.
connection
.
commit
()
def
update_log_method
(
self
,
uuid
,
method
):
try
:
self
.
connection
.
execute
(
"""
UPDATE log SET method = ? WHERE uuid = ?
"""
,
(
method
,
uuid
))
except
Exception
as
ex
:
logger
.
error
(
"
Error while updating method of log
'
%s
'"
,
uuid
)
self
.
connection
.
rollback
()
raise
self
.
connection
.
commit
()
def
get_log
(
self
,
uuid
):
curs
=
self
.
connection
.
execute
(
"""
SELECT log.uuid AS
'
uuid
'
, log.submitted AS
'
submitted
'
,
...
...
@@ -229,12 +241,12 @@ class Database(object):
return
tuple
(
data
)
def
_create_log
(
self
,
uuid
,
submitted
,
origin
,
module_id
,
method
,
message
):
def
_create_log
(
self
,
uuid
,
submitted
,
origin
,
module_id
,
message
):
self
.
connection
.
execute
(
"""
INSERT INTO log
(uuid,submitted,origin,module_id,
method,
message)
VALUES (?,?,?,?,?
,?
)
"""
,
(
uuid
,
submitted
,
origin
,
module_id
,
method
,
message
))
(uuid,submitted,origin,module_id,message)
VALUES (?,?,?,?,?)
"""
,
(
uuid
,
submitted
,
origin
,
module_id
,
message
))
def
_create_status_log
(
self
,
log_id
,
agent_id
,
agent_module_id
,
...
...
@@ -259,7 +271,7 @@ class Database(object):
submitted TEXT NOT NULL,
origin TEXT NOT NULL,
module_id INTEGER NOT NULL,
method TEXT
NO
T NULL,
method TEXT
DEFAUL
T NULL,
message TEXT NOT NULL,
CONSTRAINT log_module_id_fkey FOREIGN KEY (module_id) REFERENCES managementhost_module (id) ON UPDATE RESTRICT ON DELETE RESTRICT
)
...
...
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