Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Jérome Perrin
slapos.core
Commits
e2c03518
Commit
e2c03518
authored
May 08, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip initializeConnection raise connection error
parent
8f5ddd97
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
slapos/cli/configure_local/__init__.py
slapos/cli/configure_local/__init__.py
+16
-2
slapos/slap/slap.py
slapos/slap/slap.py
+4
-1
slapos/tests/slap.py
slapos/tests/slap.py
+7
-7
No files found.
slapos/cli/configure_local/__init__.py
View file @
e2c03518
...
@@ -32,6 +32,7 @@ import pkg_resources
...
@@ -32,6 +32,7 @@ import pkg_resources
import
re
import
re
import
subprocess
import
subprocess
import
sys
import
sys
import
time
from
slapos.cli.command
import
must_be_root
from
slapos.cli.command
import
must_be_root
from
slapos.format
import
FormatConfig
from
slapos.format
import
FormatConfig
...
@@ -245,10 +246,8 @@ def do_configure(args, fetch_config_func, logger):
...
@@ -245,10 +246,8 @@ def do_configure(args, fetch_config_func, logger):
configp = fetch_config_func(args)
configp = fetch_config_func(args)
conf = FormatConfig(logger=logger)
conf = FormatConfig(logger=logger)
conf.mergeConfig(args, configp)
conf.mergeConfig(args, configp)
slapgrid = create_slapgrid_object(conf.__dict__, logger)
createPrivateDirectory(os.path.join(conf.slapos_buildout_directory, '
log
'))
createPrivateDirectory(os.path.join(conf.slapos_buildout_directory, '
log
'))
_runFormat(conf.slapos_buildout_directory)
_runFormat(conf.slapos_buildout_directory)
slapgrid.checkEnvironmentAndCreateStructure()
proxy_configuration_file = _generateSlaposProxyConfigurationFile(conf)
proxy_configuration_file = _generateSlaposProxyConfigurationFile(conf)
conf.proxy_configuration_file = proxy_configuration_file
conf.proxy_configuration_file = proxy_configuration_file
_addProxyToSupervisor(conf)
_addProxyToSupervisor(conf)
...
@@ -258,5 +257,20 @@ def do_configure(args, fetch_config_func, logger):
...
@@ -258,5 +257,20 @@ def do_configure(args, fetch_config_func, logger):
if not os.path.exists(slapos_client_cfg_path):
if not os.path.exists(slapos_client_cfg_path):
os.symlink(slapos_node_config_path, slapos_client_cfg_path)
os.symlink(slapos_node_config_path, slapos_client_cfg_path)
launchSupervisord(instance_root=conf.instance_root, logger=logger)
launchSupervisord(instance_root=conf.instance_root, logger=logger)
# wait for slapproxy
retries = 0
while True:
time.sleep(.5)
try:
slapgrid = create_slapgrid_object(conf.__dict__, logger)
except Exception, e:
retries += 1
if retries > 20:
raise
else:
break
slapgrid.checkEnvironmentAndCreateStructure()
_runFormat(conf.slapos_buildout_directory)
_runFormat(conf.slapos_buildout_directory)
return 0
return 0
slapos/slap/slap.py
View file @
e2c03518
...
@@ -845,12 +845,15 @@ class slap:
...
@@ -845,12 +845,15 @@ class slap:
slapgrid_rest_uri
=
getHateoasUrl_cache
[
getHateoasUrl_cache_key
]
slapgrid_rest_uri
=
getHateoasUrl_cache
[
getHateoasUrl_cache_key
]
except
KeyError
:
except
KeyError
:
pass
pass
if
not
slapgrid_rest_uri
:
if
not
slapgrid_rest_uri
and
slapgrid_uri
!=
'null'
:
try
:
try
:
slapgrid_rest_uri
=
getHateoasUrl_cache
[
getHateoasUrl_cache_key
]
=
self
.
_connection_helper
.
GET
(
'getHateoasUrl'
)
slapgrid_rest_uri
=
getHateoasUrl_cache
[
getHateoasUrl_cache_key
]
=
self
.
_connection_helper
.
GET
(
'getHateoasUrl'
)
except
NotFoundError
,
e
:
except
NotFoundError
,
e
:
# master does not implement HATEOAS
# master does not implement HATEOAS
pass
pass
except
Exception
,
e
:
raise
Exception
(
"Exception raised ... %r / locals: %r"
%
(
e
,
locals
()))
raise
if
slapgrid_rest_uri
:
if
slapgrid_rest_uri
:
self
.
_hateoas_navigator
=
SlapHateoasNavigator
(
self
.
_hateoas_navigator
=
SlapHateoasNavigator
(
slapgrid_rest_uri
,
slapgrid_rest_uri
,
...
...
slapos/tests/slap.py
View file @
e2c03518
...
@@ -222,7 +222,6 @@ class TestSlap(SlapMixin):
...
@@ -222,7 +222,6 @@ class TestSlap(SlapMixin):
computer raises NotFoundError exception
computer raises NotFoundError exception
"""
"""
computer_guid
=
self
.
_getTestComputerId
()
computer_guid
=
self
.
_getTestComputerId
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
partition_id
=
'PARTITION_01'
partition_id
=
'PARTITION_01'
def
handler
(
url
,
req
):
def
handler
(
url
,
req
):
...
@@ -237,6 +236,7 @@ class TestSlap(SlapMixin):
...
@@ -237,6 +236,7 @@ class TestSlap(SlapMixin):
return
{
'status_code'
:
0
}
return
{
'status_code'
:
0
}
with
httmock
.
HTTMock
(
handler
):
with
httmock
.
HTTMock
(
handler
):
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
assertRaises
(
slapos
.
slap
.
NotFoundError
,
self
.
assertRaises
(
slapos
.
slap
.
NotFoundError
,
self
.
slap
.
registerComputerPartition
,
self
.
slap
.
registerComputerPartition
,
computer_guid
,
partition_id
)
computer_guid
,
partition_id
)
...
@@ -247,7 +247,7 @@ class TestSlap(SlapMixin):
...
@@ -247,7 +247,7 @@ class TestSlap(SlapMixin):
Asserts that calling getFullComputerInformation with empty computer_id
Asserts that calling getFullComputerInformation with empty computer_id
raises early, before calling master.
raises early, before calling master.
"""
"""
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
slap
.
initializeConnection
(
self
.
server_url
,
hateoas_url
=
self
.
server_url
)
def
handler
(
url
,
req
):
def
handler
(
url
,
req
):
# Shouldn't even be called
# Shouldn't even be called
...
@@ -263,7 +263,7 @@ class TestSlap(SlapMixin):
...
@@ -263,7 +263,7 @@ class TestSlap(SlapMixin):
Asserts that calling registerComputerPartition with empty computer_id
Asserts that calling registerComputerPartition with empty computer_id
raises early, before calling master.
raises early, before calling master.
"""
"""
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
slap
.
initializeConnection
(
self
.
server_url
,
hateoas_url
=
self
.
server_url
)
def
handler
(
url
,
req
):
def
handler
(
url
,
req
):
# Shouldn't even be called
# Shouldn't even be called
...
@@ -279,7 +279,7 @@ class TestSlap(SlapMixin):
...
@@ -279,7 +279,7 @@ class TestSlap(SlapMixin):
Asserts that calling registerComputerPartition with empty
Asserts that calling registerComputerPartition with empty
computer_partition_id raises early, before calling master.
computer_partition_id raises early, before calling master.
"""
"""
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
slap
.
initializeConnection
(
self
.
server_url
,
hateoas_url
=
self
.
server_url
)
def
handler
(
url
,
req
):
def
handler
(
url
,
req
):
# Shouldn't even be called
# Shouldn't even be called
...
@@ -295,7 +295,7 @@ class TestSlap(SlapMixin):
...
@@ -295,7 +295,7 @@ class TestSlap(SlapMixin):
Asserts that calling registerComputerPartition with empty
Asserts that calling registerComputerPartition with empty
computer_partition_id raises early, before calling master.
computer_partition_id raises early, before calling master.
"""
"""
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
slap
.
initializeConnection
(
self
.
server_url
,
hateoas_url
=
self
.
server_url
)
def
handler
(
url
,
req
):
def
handler
(
url
,
req
):
# Shouldn't even be called
# Shouldn't even be called
...
@@ -313,7 +313,6 @@ class TestSlap(SlapMixin):
...
@@ -313,7 +313,6 @@ class TestSlap(SlapMixin):
"/getSoftwareReleaseListFromSoftwareProduct" URL with correct parameters,
"/getSoftwareReleaseListFromSoftwareProduct" URL with correct parameters,
with software_product_reference parameter being specified.
with software_product_reference parameter being specified.
"""
"""
self
.
slap
.
initializeConnection
(
self
.
server_url
)
software_product_reference
=
'random_reference'
software_product_reference
=
'random_reference'
software_release_url_list
=
[
'1'
,
'2'
]
software_release_url_list
=
[
'1'
,
'2'
]
...
@@ -327,6 +326,7 @@ class TestSlap(SlapMixin):
...
@@ -327,6 +326,7 @@ class TestSlap(SlapMixin):
}
}
with
httmock
.
HTTMock
(
handler
):
with
httmock
.
HTTMock
(
handler
):
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
assertEqual
(
self
.
assertEqual
(
self
.
slap
.
getSoftwareReleaseListFromSoftwareProduct
(
self
.
slap
.
getSoftwareReleaseListFromSoftwareProduct
(
software_product_reference
=
software_product_reference
),
software_product_reference
=
software_product_reference
),
...
@@ -339,7 +339,6 @@ class TestSlap(SlapMixin):
...
@@ -339,7 +339,6 @@ class TestSlap(SlapMixin):
"/getSoftwareReleaseListFromSoftwareProduct" URL with correct parameters,
"/getSoftwareReleaseListFromSoftwareProduct" URL with correct parameters,
with software_release_url parameter being specified.
with software_release_url parameter being specified.
"""
"""
self
.
slap
.
initializeConnection
(
self
.
server_url
)
software_release_url
=
'random_url'
software_release_url
=
'random_url'
software_release_url_list
=
[
'1'
,
'2'
]
software_release_url_list
=
[
'1'
,
'2'
]
...
@@ -353,6 +352,7 @@ class TestSlap(SlapMixin):
...
@@ -353,6 +352,7 @@ class TestSlap(SlapMixin):
}
}
with
httmock
.
HTTMock
(
handler
):
with
httmock
.
HTTMock
(
handler
):
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
assertEqual
(
self
.
assertEqual
(
self
.
slap
.
getSoftwareReleaseListFromSoftwareProduct
(
self
.
slap
.
getSoftwareReleaseListFromSoftwareProduct
(
software_release_url
=
software_release_url
),
software_release_url
=
software_release_url
),
...
...
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