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
3bb17116
Commit
3bb17116
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
fix copy implementation.
parent
aea3254c
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
bin/is
+11
-14
11 additions, 14 deletions
bin/is
installsystems/repository.py
+13
-2
13 additions, 2 deletions
installsystems/repository.py
with
24 additions
and
16 deletions
bin/is
+
11
−
14
View file @
3bb17116
...
...
@@ -237,23 +237,20 @@ def c_copy(parser, args):
'''
Copy an image from a repository to another one
'''
args
.
repo_filter
=
args
.
repo_src
# load repositories
repoman
=
load_repositories
(
args
)
repo_src
=
select_one_repository
(
repoman
)
args
.
repo_filter
=
args
.
repo_dst
repoman
=
load_repositories
(
args
)
repo_dst
=
select_one_repository
(
repoman
)
if
args
.
image_version
is
None
:
args
.
image_version
=
repo_src
.
last
(
args
.
image
)
if
args
.
image_version
==
-
1
:
raise
Exception
(
"
Unable to find last version of %s
"
%
args
.
image
)
arrow
(
"
Copying %s v%s from %s to %s
"
%
(
args
.
image
,
args
.
image_version
,
repo_src
.
config
.
name
,
repo_dst
.
config
.
name
))
srcrepo
=
repoman
[
args
.
repo_src
]
dstrepo
=
repoman
[
args
.
repo_dst
]
# load source image
srcimg
=
srcrepo
.
get
(
args
.
image
,
args
.
image_version
)
# Advertise
arrow
(
"
Copying %s v%s from %s to %s
"
%
(
srcimg
.
name
,
srcimg
.
version
,
srcrepo
.
config
.
name
,
dstrepo
.
config
.
name
))
arrowlevel
(
1
)
pkg
=
repo_src
.
get
(
args
.
image
,
args
.
image_version
)
repo_dst
.
add
(
pkg
)
dstrepo
.
add
(
srcimg
)
arrowlevel
(
-
1
)
arrow
(
"
Done
"
)
def
c_help
(
parser
,
args
):
'''
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
13
−
2
View file @
3bb17116
...
...
@@ -240,10 +240,13 @@ class Repository(object):
'''
return
self
.
db
.
ask
(
"
SELECT name,version FROM image WHERE name = ? AND version = ? LIMIT 1
"
,
(
name
,
version
)).
fetchone
()
is
not
None
def
get
(
self
,
name
,
version
):
def
get
(
self
,
name
,
version
=
None
):
'''
Return an image from a name and version
'''
# is no version take the last
if
version
is
None
:
version
=
self
.
last
(
name
)
# get file md5 from db
r
=
self
.
db
.
ask
(
"
select md5 from image where name = ? and version = ? limit 1
"
,
(
name
,
version
)).
fetchone
()
...
...
@@ -483,7 +486,15 @@ class RepositoryManager(object):
'''
Return a repostiory by its position in list
'''
return
self
.
repos
[
key
]
if
type
(
key
)
==
int
:
return
self
.
repos
[
key
]
elif
type
(
key
)
==
str
:
for
repo
in
self
.
repos
:
if
repo
.
config
.
name
==
key
:
return
repo
raise
Exception
(
"
No repository named: %s
"
%
key
)
else
:
raise
TypeError
def
register
(
self
,
config
):
'''
...
...
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