Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
28ede21f
Commit
28ede21f
authored
May 01, 2018
by
Pietro Albini
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'init-command' into develop
parents
7f9c0a5a
49eac26c
Pipeline
#81
passed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
managetests.json
managetests.json
+3
-0
uitwww/__main__.py
uitwww/__main__.py
+10
-0
uitwww/launchpad.py
uitwww/launchpad.py
+12
-2
No files found.
managetests.json
View file @
28ede21f
...
@@ -12,6 +12,9 @@
...
@@ -12,6 +12,9 @@
"command"
:
[
"{{base}}/env/bin/pip"
,
"install"
,
"{{artifact}}"
]
"command"
:
[
"{{base}}/env/bin/pip"
,
"install"
,
"{{artifact}}"
]
}
}
],
],
"after_install"
:
[
[
"{{base}}/env/bin/uitwww"
,
"init"
,
"{{base}}/data"
]
],
"run"
:
[
"run"
:
[
"{{base}}/env/bin/uitwww"
,
"run"
,
"-g"
,
"{{gunicorn_config_file}}"
,
"{{base}}/env/bin/uitwww"
,
"run"
,
"-g"
,
"{{gunicorn_config_file}}"
,
"{{base}}/data"
"{{base}}/data"
...
...
uitwww/__main__.py
View file @
28ede21f
...
@@ -37,6 +37,7 @@ def cli():
...
@@ -37,6 +37,7 @@ def cli():
@
click
.
option
(
"-w"
,
"--workers"
,
help
=
"Number of workers to start"
,
default
=
3
)
@
click
.
option
(
"-w"
,
"--workers"
,
help
=
"Number of workers to start"
,
default
=
3
)
@
click
.
option
(
"-d"
,
"--debug"
,
help
=
"Enable debug mode"
,
is_flag
=
True
)
@
click
.
option
(
"-d"
,
"--debug"
,
help
=
"Enable debug mode"
,
is_flag
=
True
)
def
run
(
data
,
gunicorn_config
,
port
,
public
,
workers
,
debug
):
def
run
(
data
,
gunicorn_config
,
port
,
public
,
workers
,
debug
):
"""Run the application"""
# Create the application instance
# Create the application instance
src_directory
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
src_directory
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
@@ -70,3 +71,12 @@ def run(data, gunicorn_config, port, public, workers, debug):
...
@@ -70,3 +71,12 @@ def run(data, gunicorn_config, port, public, workers, debug):
server
.
run
()
server
.
run
()
except
SystemExit
:
except
SystemExit
:
pass
pass
@
cli
.
command
(
"init"
)
@
click
.
argument
(
"data"
)
def
init
(
data
):
"""Initialize the data directory"""
print
(
"Initializing data directory:"
,
data
)
data_path
=
os
.
path
.
expanduser
(
os
.
path
.
abspath
(
data
))
uitwww
.
init_data_directory
(
data_path
)
uitwww/launchpad.py
View file @
28ede21f
...
@@ -23,8 +23,15 @@ BASE = "https://api.launchpad.net/devel"
...
@@ -23,8 +23,15 @@ BASE = "https://api.launchpad.net/devel"
def
fetch_paginated
(
initial
):
def
fetch_paginated
(
initial
):
"""Fetch paginated data"""
"""Fetch paginated data"""
next_url
=
initial
next_url
=
initial
while
True
:
retry_count
=
0
data
=
requests
.
get
(
next_url
).
json
()
while
retry_count
<
5
:
resp
=
requests
.
get
(
next_url
)
if
resp
.
status_code
==
200
:
retry_count
=
0
data
=
resp
.
json
()
else
:
retry_count
+=
1
continue
for
entry
in
data
[
"entries"
]:
for
entry
in
data
[
"entries"
]:
yield
entry
yield
entry
...
@@ -33,6 +40,9 @@ def fetch_paginated(initial):
...
@@ -33,6 +40,9 @@ def fetch_paginated(initial):
break
break
next_url
=
data
[
"next_collection_link"
]
next_url
=
data
[
"next_collection_link"
]
if
retry_count
:
raise
RuntimeError
(
"Failed to contact launchpad!"
)
def
get_cdimage_mirrors
(
distro
,
country
):
def
get_cdimage_mirrors
(
distro
,
country
):
"""Get a list of cdimage mirrors"""
"""Get a list of cdimage mirrors"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment