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
28506fc6
Commit
28506fc6
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
Add timeout paramter to isinstall
parent
f562ee94
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/isinstall
+4
-2
4 additions, 2 deletions
bin/isinstall
installsystems/repository.py
+6
-6
6 additions, 6 deletions
installsystems/repository.py
with
10 additions
and
8 deletions
bin/isinstall
+
4
−
2
View file @
28506fc6
...
@@ -37,7 +37,9 @@ p_main.add_argument('-q', "--quiet", action="store_false", dest="verbose", defau
...
@@ -37,7 +37,9 @@ p_main.add_argument('-q', "--quiet", action="store_false", dest="verbose", defau
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
dest
=
"
config
"
,
type
=
str
,
default
=
None
,
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
dest
=
"
config
"
,
type
=
str
,
default
=
None
,
help
=
"
config file path
"
)
help
=
"
config file path
"
)
p_main
.
add_argument
(
"
-v
"
,
"
--image-version
"
,
dest
=
"
image_version
"
,
type
=
int
,
default
=
None
,
p_main
.
add_argument
(
"
-v
"
,
"
--image-version
"
,
dest
=
"
image_version
"
,
type
=
int
,
default
=
None
,
help
=
"
specific image version
"
)
help
=
"
image version
"
)
p_main
.
add_argument
(
"
-t
"
,
"
--timeout
"
,
dest
=
"
timeout
"
,
type
=
int
,
default
=
3
,
help
=
"
download timeout
"
)
p_main
.
add_argument
(
"
image_name
"
,
type
=
str
,
p_main
.
add_argument
(
"
image_name
"
,
type
=
str
,
help
=
"
image to install (path or name)
"
)
help
=
"
image to install (path or name)
"
)
try
:
try
:
...
@@ -51,7 +53,7 @@ try:
...
@@ -51,7 +53,7 @@ try:
pkg
=
PackageImage
(
istools
.
abspath
(
args
.
image_name
))
pkg
=
PackageImage
(
istools
.
abspath
(
args
.
image_name
))
elif
image_name_type
==
"
name
"
:
elif
image_name_type
==
"
name
"
:
# init repo cache object
# init repo cache object
repocache
=
RepositoryCache
(
config
.
cache
,
verbose
=
args
.
verbose
)
repocache
=
RepositoryCache
(
config
.
cache
,
timeout
=
args
.
timeout
,
verbose
=
args
.
verbose
)
# register repositories
# register repositories
repocache
.
register
(
config
.
repos
)
repocache
.
register
(
config
.
repos
)
# update remote info
# update remote info
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
6
−
6
View file @
28506fc6
...
@@ -176,8 +176,9 @@ class RepositoryConfig(object):
...
@@ -176,8 +176,9 @@ class RepositoryConfig(object):
class
RepositoryCache
(
object
):
class
RepositoryCache
(
object
):
'''
Local repository cache class
'''
'''
Local repository cache class
'''
def
__init__
(
self
,
cache_path
,
verbose
=
True
):
def
__init__
(
self
,
cache_path
,
timeout
=
3
,
verbose
=
True
):
self
.
verbose
=
verbose
self
.
verbose
=
verbose
self
.
timeout
=
timeout
self
.
repos
=
{}
self
.
repos
=
{}
self
.
path
=
os
.
path
.
abspath
(
cache_path
)
self
.
path
=
os
.
path
.
abspath
(
cache_path
)
# ensure cache directories are avaiblable
# ensure cache directories are avaiblable
...
@@ -209,9 +210,9 @@ class RepositoryCache(object):
...
@@ -209,9 +210,9 @@ class RepositoryCache(object):
# last local
# last local
local_last
=
self
.
last
(
r
)
local_last
=
self
.
last
(
r
)
# copy last file
# copy last file
arrow
(
"
C
opy
ing %s repository last
"
%
r
,
2
,
self
.
verbose
)
arrow
(
"
C
heck
ing %s repository last
"
%
r
,
2
,
self
.
verbose
)
istools
.
copy
(
self
.
repos
[
r
][
"
orig
"
].
last_path
,
istools
.
copy
(
self
.
repos
[
r
][
"
orig
"
].
last_path
,
self
.
repos
[
r
][
"
cache
"
].
last_path
,)
self
.
repos
[
r
][
"
cache
"
].
last_path
,
timeout
=
self
.
timeout
)
# last after update
# last after update
remote_last
=
self
.
last
(
r
)
remote_last
=
self
.
last
(
r
)
debug
(
"
%s: last: local: %s, remote:%s
"
%
(
r
,
local_last
,
remote_last
))
debug
(
"
%s: last: local: %s, remote:%s
"
%
(
r
,
local_last
,
remote_last
))
...
@@ -221,8 +222,7 @@ class RepositoryCache(object):
...
@@ -221,8 +222,7 @@ class RepositoryCache(object):
if
remote_last
>
local_last
or
not
os
.
path
.
exists
(
local_db
):
if
remote_last
>
local_last
or
not
os
.
path
.
exists
(
local_db
):
# copy db file
# copy db file
arrow
(
"
Copying %s repository db
"
%
r
,
2
,
self
.
verbose
)
arrow
(
"
Copying %s repository db
"
%
r
,
2
,
self
.
verbose
)
istools
.
copy
(
remote_db
,
local_db
)
istools
.
copy
(
remote_db
,
local_db
,
timeout
=
self
.
timeout
)
arrow
(
"
%s updated
"
%
r
,
2
,
self
.
verbose
)
def
last
(
self
,
reponame
):
def
last
(
self
,
reponame
):
'''
Return the last timestamp of a repo
'''
'''
Return the last timestamp of a repo
'''
...
@@ -244,7 +244,7 @@ class RepositoryCache(object):
...
@@ -244,7 +244,7 @@ class RepositoryCache(object):
# get remote image
# get remote image
remotepath
=
os
.
path
.
join
(
self
.
repos
[
reponame
][
"
orig
"
].
config
.
image
,
filename
)
remotepath
=
os
.
path
.
join
(
self
.
repos
[
reponame
][
"
orig
"
].
config
.
image
,
filename
)
arrow
(
"
Copying from repository
"
,
2
,
self
.
verbose
)
arrow
(
"
Copying from repository
"
,
2
,
self
.
verbose
)
istools
.
copy
(
remotepath
,
cachepath
)
istools
.
copy
(
remotepath
,
cachepath
,
timeout
=
self
.
timeout
)
return
cachepath
return
cachepath
def
find_image
(
self
,
name
,
version
):
def
find_image
(
self
,
name
,
version
):
...
...
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