Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vl-dcc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Rolf Niepraschk
vl-dcc
Commits
9a9c52b8
Commit
9a9c52b8
authored
4 years ago
by
Rolf Niepraschk
Browse files
Options
Downloads
Patches
Plain Diff
"version" and "update" modified
parent
8cb88937
Branches
Branches containing commit
Tags
0.1.29
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.py
+9
-11
9 additions, 11 deletions
server.py
with
9 additions
and
11 deletions
server.py
+
9
−
11
View file @
9a9c52b8
...
@@ -45,16 +45,14 @@ def append_cert(year_cert):
...
@@ -45,16 +45,14 @@ def append_cert(year_cert):
def
main
():
def
main
():
return
utils
.
return_error
(
'
Cert ID missing
'
)
return
utils
.
return_error
(
'
Cert ID missing
'
)
@app.route
(
'
/update
'
,
methods
=
[
'
post
'
])
@app.route
(
'
/update
'
,
methods
=
[
'
POST
'
])
def
update
():
def
update
():
app
.
logger
.
debug
(
'
hit update
'
)
app
.
logger
.
debug
(
'
hit update
'
)
req
=
request
.
get_json
()
req
=
request
.
get_json
()
#pprint(req)
##
#pprint(req)
tarball_url
=
req
[
'
repository
'
][
'
homepage
'
]
+
'
/-/archive/master/
'
+
\
tarball_url
=
req
[
'
repository
'
][
'
homepage
'
]
+
'
/-/archive/master/
'
+
\
req
[
'
repository
'
][
'
name
'
]
+
'
-master.tar
'
req
[
'
repository
'
][
'
name
'
]
+
'
-master.tar
'
version
=
req
[
'
ref
'
].
split
(
'
/
'
)[
2
]
+
'
-
'
+
req
[
'
checkout_sha
'
]
version
=
str
(
utils
.
get_version
())
with
open
(
'
./VERSION
'
,
'
w
'
)
as
f
:
# TODO: anderes Verfahren
print
(
version
,
file
=
f
)
with
open
(
'
./LOG
'
,
'
a
'
)
as
f
:
with
open
(
'
./LOG
'
,
'
a
'
)
as
f
:
print
(
datetime
.
now
().
strftime
(
"
[%Y-%m-%d %H:%M:%S]
"
+
version
),
file
=
f
)
print
(
datetime
.
now
().
strftime
(
"
[%Y-%m-%d %H:%M:%S]
"
+
version
),
file
=
f
)
try
:
try
:
...
@@ -63,20 +61,20 @@ def update():
...
@@ -63,20 +61,20 @@ def update():
output
=
subprocess
.
check_output
((
'
/usr/bin/tar
'
,
'
--extract
'
,
\
output
=
subprocess
.
check_output
((
'
/usr/bin/tar
'
,
'
--extract
'
,
\
'
-f
'
,
'
-
'
,
'
--strip-components=1
'
),
stdin
=
ps
.
stdout
)
'
-f
'
,
'
-
'
,
'
--strip-components=1
'
),
stdin
=
ps
.
stdout
)
ps
.
wait
()
ps
.
wait
()
except
:
except
Exception
as
error
:
app
.
logger
.
debug
(
str
(
error
))
app
.
logger
.
debug
(
str
(
error
))
return
jsonify
({
'
error
'
:
str
(
error
)})
return
jsonify
({
'
error
'
:
str
(
error
)})
return
jsonify
({
'
OK
'
:
True
})
return
jsonify
({
'
ok
'
:
True
})
@app.route
(
'
/version
'
,
methods
=
[
'
GET
'
])
@app.route
(
'
/version
'
,
methods
=
[
'
get
'
])
def
version
():
def
version
():
app
.
logger
.
debug
(
'
hit version
'
)
app
.
logger
.
debug
(
'
hit version
'
)
version
=
utils
.
get_version
()
version
=
utils
.
get_version
()
if
version
:
if
version
:
return
jsonify
({
'
version
'
:
version
})
return
jsonify
({
'
version
'
:
version
})
else
:
else
:
return
utils
.
return_
error
(
'
Version unknown
'
)
return
jsonify
({
'
error
'
:
'
Version unknown
'
}
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
app
.
run
(
host
=
config
[
'
server
'
][
'
host
'
],
port
=
config
[
'
server
'
][
'
port
'
])
app
.
run
(
host
=
config
[
'
server
'
][
'
host
'
],
port
=
config
[
'
server
'
][
'
port
'
])
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