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
26e8f22f
Commit
26e8f22f
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
Better detection of image name type
parent
0f241165
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bin/isinstall
+5
-2
5 additions, 2 deletions
bin/isinstall
installsystems/image.py
+11
-0
11 additions, 0 deletions
installsystems/image.py
installsystems/repository.py
+1
-1
1 addition, 1 deletion
installsystems/repository.py
installsystems/tools.py
+3
-0
3 additions, 0 deletions
installsystems/tools.py
with
20 additions
and
3 deletions
bin/isinstall
+
5
−
2
View file @
26e8f22f
...
...
@@ -49,9 +49,10 @@ try:
# Partial parse
args
=
p_main
.
parse_known_args
()[
0
]
# looks if arguments is a file or image name
if
istools
.
get_path_type
(
args
.
image_name
)
==
"
file
"
:
image_name_type
=
istools
.
get_path_type
(
args
.
image_name
)
if
image_name_type
==
"
file
"
:
pkg
=
PackageImage
(
istools
.
complete_path
(
args
.
image_name
))
el
se
:
el
if
image_name_type
==
"
name
"
:
# init repo cache object
repocache
=
RepositoryCache
(
args
.
cache_path
,
verbose
=
args
.
verbose
)
# register command ligne repo
...
...
@@ -62,6 +63,8 @@ try:
repocache
.
update
()
# get image package
pkg
=
repocache
.
get
(
args
.
image_name
,
args
.
image_version
)
else
:
raise
Exception
(
"
Invalid image name
"
)
# run parser scripts
pkg
.
run_parser
({
"
parser
"
:
p_main
})
# call parser again, with extended attributes
...
...
This diff is collapsed.
Click to expand it.
installsystems/image.py
+
11
−
0
View file @
26e8f22f
...
...
@@ -17,6 +17,7 @@ import ConfigParser
import
subprocess
import
json
import
tarfile
import
re
import
installsystems.template
from
installsystems.printer
import
*
from
installsystems.tarball
import
Tarball
...
...
@@ -29,6 +30,16 @@ class Image(object):
image_payload
=
"
.isdata
"
image_format
=
"
1
"
@staticmethod
def
check_image_name
(
buf
):
'''
Check if @name is a valid image name
'''
return
re
.
match
(
"
\w+
"
,
buf
)
is
not
None
@staticmethod
def
check_image_version
(
buf
):
'''
Check if @name is a valid image version
'''
return
re
.
match
(
"
\d+
"
,
buf
)
is
not
None
def
__init__
(
self
,
pbzip2
=
True
):
self
.
pbzip2_path
=
self
.
path_search
(
"
pbzip2
"
)
if
pbzip2
else
None
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
1
−
1
View file @
26e8f22f
...
...
@@ -129,7 +129,7 @@ class RepositoryCache(object):
def
register
(
self
,
name
,
image
,
data
):
'''
Register a repository to track
'''
self
.
repos
[
name
]
=
Repository
(
istools
.
complete_path
(
image
),
istools
.
complete_path
h
(
data
),
istools
.
complete_path
(
data
),
verbose
=
self
.
verbose
)
def
update
(
self
):
...
...
This diff is collapsed.
Click to expand it.
installsystems/tools.py
+
3
−
0
View file @
26e8f22f
...
...
@@ -7,6 +7,7 @@ InstallSystems Generic Tools Library
'''
import
os
from
installsystems.image
import
Image
def
cp
(
self
,
source
,
destination
):
'''
Copy a source to destination. Take care of path type
'''
...
...
@@ -25,6 +26,8 @@ def get_path_type(path):
return
"
ssh
"
elif
path
.
startswith
(
"
file://
"
)
or
os
.
path
.
exists
(
path
):
return
"
file
"
elif
Image
.
check_image_name
(
path
):
return
"
name
"
return
None
def
complete_path
(
path
):
...
...
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