Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos.package
Commits
63b7ac92
Commit
63b7ac92
authored
Jul 16, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve erp5-show to be more fault tolerant and provide more informations.
parent
7c77a22d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
3 deletions
+48
-3
playbook/roles/standalone-shared/files/erp5-show
playbook/roles/standalone-shared/files/erp5-show
+48
-3
No files found.
playbook/roles/standalone-shared/files/erp5-show
View file @
63b7ac92
...
...
@@ -7,7 +7,8 @@ import glob
import
time
import
getopt
import
sqlite3
from
urllib2
import
urlopen
import
ssl
import
urllib2
from
xml.dom
import
minidom
import
json
...
...
@@ -20,15 +21,21 @@ def discover_software():
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
cur
=
conn
.
cursor
()
qry
=
cur
.
execute
(
"SELECT DISTINCT software_release FROM partition11"
)
return
[
row
[
0
]
for
row
in
qry
]
return
[
row
[
0
]
for
row
in
qry
if
row
[
0
]
]
def
get_connection_information
(
software_release
):
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
cur
=
conn
.
cursor
()
qry
=
cur
.
execute
(
"SELECT connection_xml FROM partition11 WHERE connection_xml IS NOT NULL AND software_release=?"
,
(
software_release
,)
)
xml
=
None
for
row
in
qry
:
xml
=
str
(
row
[
0
])
break
if
xml
is
None
:
print
software_release
return
(
None
,
None
)
instance
=
minidom
.
parseString
(
xml
)
try
:
...
...
@@ -90,13 +97,51 @@ def status(software_release):
fmt_date
()
+
".log for details"
sys
.
exit
(
2
)
ipv6
=
None
# check if the services are actually running (run slapos node and parse output)
if
pw
is
None
:
zope_ip
=
"https://"
+
zope_ip
[
zope_ip
.
index
(
"@"
)
+
1
:]
r1
=
urlopen
(
zope_ip
)
original_zope_ip
=
zope_ip
if
"["
in
zope_ip
and
"]"
in
zope_ip
:
ipv6
=
zope_ip
[
zope_ip
.
index
(
"["
)
+
1
:
zope_ip
.
index
(
"]"
)]
with
open
(
"/etc/hosts"
,
"ra+"
)
as
f
:
if
" erp5-instance"
not
in
f
.
read
():
f
.
write
(
"
\
n
%s erp5-instance
\
n
"
%
ipv6
)
zope_ip
=
zope_ip
.
replace
(
"["
+
ipv6
+
"]"
,
"erp5-instance"
)
ctx
=
ssl
.
create_default_context
()
ctx
.
check_hostname
=
False
ctx
.
verify_mode
=
ssl
.
CERT_NONE
try
:
r1
=
urllib2
.
urlopen
(
zope_ip
,
context
=
ctx
)
except
urllib2
.
URLError
,
e
:
print
"At least one of your services isn't running! Check with slapos node"
print
"restart a service with slapos node restart slappart:service"
print
""
print
"DEBUG information: %s"
%
e
sys
.
exit
(
2
)
if
r1
.
getcode
()
!=
200
:
print
"At least one of your services isn't running! Check with slapos node"
print
"restart a service with slapos node restart slappart:service"
sys
.
exit
(
2
)
if
ipv6
:
print
""
print
"The URL above may require extra configuration if you want to access it"
print
"from another machine. You can install an apache locally and include the"
print
"the follow rewrite rule (http version):"
print
"""
RewriteRule ^/(.*) %s/VirtualHostBase/http/%%{HTTP_HOST}/VirtualHostRoot/$1 [L,P]
or (https version):
RewriteRule ^/(.*) %s/VirtualHostBase/https/%%{HTTP_HOST}/VirtualHostRoot/$1 [L,P]
"""
%
(
original_zope_ip
,
original_zope_ip
)
def
info
(
software_release
):
if
get_build_status
():
...
...
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