Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
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
Seblu
installsystems
Commits
803e86d7
Commit
803e86d7
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
handle db add in repo add
parent
09f8b869
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
installsystems/database.py
+0
-35
0 additions, 35 deletions
installsystems/database.py
installsystems/repository.py
+25
-1
25 additions, 1 deletion
installsystems/repository.py
with
25 additions
and
36 deletions
installsystems/database.py
+
0
−
35
View file @
803e86d7
...
...
@@ -68,38 +68,3 @@ class Database(object):
Ask question to db
'''
return
self
.
conn
.
execute
(
sql
,
args
)
def
add
(
self
,
image
):
'''
Add a packaged image to a db
'''
try
:
# let's go
arrow
(
"
Begin transaction to db
"
)
arrowlevel
(
1
)
self
.
conn
.
execute
(
"
BEGIN TRANSACTION
"
)
# insert image information
arrow
(
"
Add image metadata
"
)
self
.
conn
.
execute
(
"
INSERT INTO image values (?,?,?,?,?,?,?)
"
,
(
image
.
md5
,
image
.
name
,
image
.
version
,
image
.
date
,
image
.
author
,
image
.
description
,
image
.
size
,
))
# insert data informations
arrow
(
"
Add payload metadata
"
)
for
name
,
obj
in
image
.
payload
.
items
():
self
.
conn
.
execute
(
"
INSERT INTO payload values (?,?,?,?,?)
"
,
(
obj
.
md5
,
image
.
md5
,
name
,
obj
.
isdir
,
obj
.
size
,
))
# on commit
arrow
(
"
Commit transaction to db
"
)
self
.
conn
.
execute
(
"
COMMIT TRANSACTION
"
)
arrowlevel
(
-
1
)
except
Exception
as
e
:
raise
Exception
(
"
Adding metadata fail: %s
"
%
e
)
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
25
−
1
View file @
803e86d7
...
...
@@ -118,7 +118,31 @@ class Repository(object):
# checking image and payload after copy
r_image
.
check
(
"
Check image and payload after copy
"
)
# add description to db
self
.
db
.
add
(
r_image
)
arrow
(
"
Adding metadata
"
)
self
.
db
.
begin
()
# insert image information
arrow
(
"
Image
"
,
1
)
self
.
db
.
ask
(
"
INSERT INTO image values (?,?,?,?,?,?,?)
"
,
(
image
.
md5
,
image
.
name
,
image
.
version
,
image
.
date
,
image
.
author
,
image
.
description
,
image
.
size
,
))
# insert data informations
arrow
(
"
Payloads
"
,
1
)
for
name
,
obj
in
image
.
payload
.
items
():
self
.
db
.
ask
(
"
INSERT INTO payload values (?,?,?,?,?)
"
,
(
obj
.
md5
,
image
.
md5
,
name
,
obj
.
isdir
,
obj
.
size
,
))
# on commit
self
.
db
.
commit
()
# update last file
self
.
update_last
()
...
...
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