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
998ea972
Commit
998ea972
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
Introducing a new way of selecting image
new syntax is available [repo/]image[:version] first command updated is delete
parent
09edf41d
No related branches found
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
+36
-4
36 additions, 4 deletions
bin/is
installsystems/repository.py
+1
-1
1 addition, 1 deletion
installsystems/repository.py
with
37 additions
and
5 deletions
bin/is
+
36
−
4
View file @
998ea972
...
@@ -12,6 +12,7 @@ import time
...
@@ -12,6 +12,7 @@ import time
import
fnmatch
import
fnmatch
import
datetime
import
datetime
import
argparse
import
argparse
import
re
import
installsystems
import
installsystems
import
installsystems.tools
as
istools
import
installsystems.tools
as
istools
from
installsystems.printer
import
*
from
installsystems.printer
import
*
...
@@ -52,6 +53,24 @@ def select_one_repository(repoman):
...
@@ -52,6 +53,24 @@ def select_one_repository(repoman):
raise
Exception
(
"
Please select only one repository
"
)
raise
Exception
(
"
Please select only one repository
"
)
return
repoman
[
0
]
return
repoman
[
0
]
def
select_image
(
name
,
repoman
):
'''
Select and load a package image from a standard naming type
Allowed type are a direct filename on filesystem
or [repo/]image[:version]
Return the repository as second argument
'''
if
istools
.
isfile
(
name
)
and
os
.
path
.
isfile
(
name
):
return
PackageImage
(
name
),
None
else
:
(
repo
,
image
,
version
)
=
re
.
match
(
"
((\w+)/)?(\w+)(:(\d+))?
"
,
name
).
group
(
2
,
3
,
5
)
if
repo
is
None
:
return
repoman
.
get
(
image
,
version
)
else
:
return
repoman
[
repo
].
get
(
image
,
version
),
repoman
[
repo
]
def
c_new
(
parser
,
args
):
def
c_new
(
parser
,
args
):
'''
'''
Create a new source image
Create a new source image
...
@@ -96,8 +115,19 @@ def c_del(parser, args):
...
@@ -96,8 +115,19 @@ def c_del(parser, args):
Remove an image package from a repository
Remove an image package from a repository
'''
'''
repoman
=
load_repositories
(
args
)
repoman
=
load_repositories
(
args
)
repo
=
select_one_repository
(
repoman
)
for
image
in
args
.
image
:
repo
.
delete
(
args
.
image_name
,
args
.
image_version
)
img
,
repo
=
select_image
(
image
,
repoman
)
if
repo
is
None
:
raise
Exception
(
"
You cannot delete an image outside a repository
"
)
if
args
.
force
:
repo
.
delete
(
img
.
name
,
img
.
version
)
else
:
warn
(
"
The following opereation cannot be reversed!
"
)
out
(
"
You will delete %s v%s in repository %s
"
%
(
img
.
name
,
img
.
version
,
repo
.
config
.
name
))
if
raw_input
(
"
Are you sure (yes)
"
)
==
"
yes
"
:
repo
.
delete
(
img
.
name
,
img
.
version
)
def
c_install
(
parser
,
args
):
def
c_install
(
parser
,
args
):
'''
'''
...
@@ -321,8 +351,10 @@ p_add.set_defaults(func=c_add)
...
@@ -321,8 +351,10 @@ p_add.set_defaults(func=c_add)
# del command parser
# del command parser
p_del
=
subparsers
.
add_parser
(
"
del
"
,
help
=
c_del
.
__doc__
.
lower
())
p_del
=
subparsers
.
add_parser
(
"
del
"
,
help
=
c_del
.
__doc__
.
lower
())
p_del
.
add_argument
(
"
image_name
"
)
p_del
.
add_argument
(
"
image
"
,
nargs
=
"
+
"
,
p_del
.
add_argument
(
"
image_version
"
)
help
=
"
image to delete
"
)
p_del
.
add_argument
(
"
-f
"
,
"
--force
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
delete image without confirmation
"
)
p_del
.
set_defaults
(
func
=
c_del
)
p_del
.
set_defaults
(
func
=
c_del
)
# install command parser
# install command parser
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
1
−
1
View file @
998ea972
...
@@ -574,7 +574,7 @@ class RepositoryManager(object):
...
@@ -574,7 +574,7 @@ class RepositoryManager(object):
# search image in repos
# search image in repos
for
repo
in
self
.
repos
:
for
repo
in
self
.
repos
:
if
repo
.
has
(
name
,
version
):
if
repo
.
has
(
name
,
version
):
return
repo
.
get
(
name
,
version
)
return
repo
.
get
(
name
,
version
)
,
repo
raise
Exception
(
"
Unable to find %s v%s
"
%
(
name
,
version
))
raise
Exception
(
"
Unable to find %s v%s
"
%
(
name
,
version
))
def
show
(
self
,
verbose
=
False
):
def
show
(
self
,
verbose
=
False
):
...
...
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