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
024b8248
Commit
024b8248
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
introduce repo and database strict versionning
parent
f61d2075
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
+13
-0
13 additions, 0 deletions
installsystems/database.py
installsystems/repository.py
+7
-2
7 additions, 2 deletions
installsystems/repository.py
with
20 additions
and
2 deletions
installsystems/database.py
+
13
−
0
View file @
024b8248
...
...
@@ -47,10 +47,23 @@ class Database(object):
raise
Exception
(
"
Database not exists
"
)
self
.
conn
=
sqlite3
.
connect
(
self
.
path
,
isolation_level
=
None
)
self
.
conn
.
execute
(
"
PRAGMA foreign_keys = ON
"
)
# get database version
try
:
r
=
self
.
ask
(
"
SELECT value FROM misc WHERE key =
'
version
'"
).
fetchone
()
if
r
is
None
:
raise
TypeError
()
self
.
version
=
r
[
0
]
except
:
self
.
version
=
u
"
1
"
# we only support database v1
if
self
.
version
!=
u
"
1
"
:
debug
(
"
Invalid database format: %s
"
%
self
.
version
)
raise
Exception
(
"
Invalid database format
"
)
# we make a query to be sure format is valid
try
:
self
.
ask
(
"
SELECT * FROM image
"
)
except
:
debug
(
"
Invalid database format: %s
"
%
self
.
version
)
raise
Exception
(
"
Invalid database format
"
)
def
begin
(
self
):
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
7
−
2
View file @
024b8248
...
...
@@ -66,7 +66,6 @@ class Repository(object):
def
__init__
(
self
,
config
):
self
.
config
=
config
self
.
version
=
1
self
.
local
=
istools
.
isfile
(
self
.
config
.
path
)
if
not
self
.
config
.
offline
:
try
:
...
...
@@ -76,7 +75,6 @@ class Repository(object):
if
self
.
config
.
offline
:
debug
(
"
Repository %s is offline
"
%
config
.
name
)
def
__getattribute__
(
self
,
name
):
'''
Raise an error if repository is unavailable
...
...
@@ -92,6 +90,13 @@ class Repository(object):
raise
Exception
(
"
Repository %s is offline
"
%
config
.
name
)
return
object
.
__getattribute__
(
self
,
name
)
@property
def
version
(
self
):
'''
Return repository version
'''
return
self
.
db
.
version
def
init
(
self
):
'''
Initialize an empty base repository
...
...
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