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
Eric Zheng
slapos.core
Commits
d2d044d4
Commit
d2d044d4
authored
Jul 25, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove trailing whitespaces in slapos.core code
parent
22056e81
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
58 deletions
+60
-58
slapos/console.py
slapos/console.py
+4
-4
slapos/format.py
slapos/format.py
+6
-6
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+1
-1
slapos/grid/__init__.py
slapos/grid/__init__.py
+1
-1
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+7
-5
slapos/slap/interface/slap.py
slapos/slap/interface/slap.py
+14
-14
slapos/slap/slap.py
slapos/slap/slap.py
+5
-5
slapos/tests/slap.py
slapos/tests/slap.py
+22
-22
No files found.
slapos/console.py
View file @
d2d044d4
...
@@ -156,11 +156,11 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0]
...
@@ -156,11 +156,11 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0]
config
=
Config
()
config
=
Config
()
options
,
arguments
=
RequestParser
(
usage
=
usage
).
check_args
()
options
,
arguments
=
RequestParser
(
usage
=
usage
).
check_args
()
config
.
setConfig
(
options
,
arguments
[
0
])
config
.
setConfig
(
options
,
arguments
[
0
])
local
=
init
(
config
)
local
=
init
(
config
)
# Request instance
# Request instance
# XXX-Cedric : support things like :
# XXX-Cedric : support things like :
# --instance-type std --configuration-size 23 --computer-region europe/france
# --instance-type std --configuration-size 23 --computer-region europe/france
# XXX-Cedric : add support for xml_parameter
# XXX-Cedric : add support for xml_parameter
software_url
=
arguments
[
1
]
software_url
=
arguments
[
1
]
...
@@ -196,6 +196,6 @@ examples :
...
@@ -196,6 +196,6 @@ examples :
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")"""
%
sys
.
argv
[
0
]
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")"""
%
sys
.
argv
[
0
]
config
=
Config
()
config
=
Config
()
config
.
setConfig
(
*
Parser
(
usage
=
usage
).
check_args
())
config
.
setConfig
(
*
Parser
(
usage
=
usage
).
check_args
())
local
=
init
(
config
)
local
=
init
(
config
)
__import__
(
"code"
).
interact
(
banner
=
""
,
local
=
local
)
__import__
(
"code"
).
interact
(
banner
=
""
,
local
=
local
)
slapos/format.py
View file @
d2d044d4
...
@@ -211,7 +211,7 @@ class Computer(object):
...
@@ -211,7 +211,7 @@ class Computer(object):
return
self
.
interface
.
addAddr
()
return
self
.
interface
.
addAddr
()
# Can't find address
# Can't find address
raise
NoAddressOnInterface
(
'No valid IPv6 found on %s.'
%
raise
NoAddressOnInterface
(
'No valid IPv6 found on %s.'
%
self
.
interface
.
name
)
self
.
interface
.
name
)
def
send
(
self
,
config
):
def
send
(
self
,
config
):
...
@@ -237,7 +237,7 @@ class Computer(object):
...
@@ -237,7 +237,7 @@ class Computer(object):
raise
slap
.
NotFoundError
(
"%s
\
n
ERROR : This SlapOS node is not recognised by "
raise
slap
.
NotFoundError
(
"%s
\
n
ERROR : This SlapOS node is not recognised by "
"SlapOS Master. Please make sure computer_id of slapos.cfg looks "
"SlapOS Master. Please make sure computer_id of slapos.cfg looks "
"like 'COMP-123' and is correct.
\
n
Error is : 404 Not Found."
%
error
)
"like 'COMP-123' and is correct.
\
n
Error is : 404 Not Found."
%
error
)
return
return
def
dump
(
self
,
path_to_xml
):
def
dump
(
self
,
path_to_xml
):
"""
"""
...
@@ -311,7 +311,7 @@ class Computer(object):
...
@@ -311,7 +311,7 @@ class Computer(object):
if
alter_network
and
self
.
address
is
not
None
:
if
alter_network
and
self
.
address
is
not
None
:
self
.
interface
.
addAddr
(
self
.
address
,
self
.
netmask
)
self
.
interface
.
addAddr
(
self
.
address
,
self
.
netmask
)
for
path
in
self
.
instance_root
,
self
.
software_root
:
for
path
in
self
.
instance_root
,
self
.
software_root
:
if
not
os
.
path
.
exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
os
.
makedirs
(
path
,
0755
)
os
.
makedirs
(
path
,
0755
)
else
:
else
:
...
@@ -677,7 +677,7 @@ class Interface(object):
...
@@ -677,7 +677,7 @@ class Interface(object):
def
_addSystemAddress
(
self
,
address
,
netmask
,
ipv6
=
True
):
def
_addSystemAddress
(
self
,
address
,
netmask
,
ipv6
=
True
):
"""Adds system address to interface
"""Adds system address to interface
Returns True if address was added successfully.
Returns True if address was added successfully.
Returns False if there was issue.
Returns False if there was issue.
...
@@ -870,7 +870,7 @@ class Parser(OptionParser):
...
@@ -870,7 +870,7 @@ class Parser(OptionParser):
help
=
"Shall slapformat alter user database [default: True]"
),
help
=
"Shall slapformat alter user database [default: True]"
),
Option
(
'--alter_network'
,
choices
=
[
'True'
,
'False'
],
Option
(
'--alter_network'
,
choices
=
[
'True'
,
'False'
],
help
=
"Shall slapformat alter network configuration [default: True]"
),
help
=
"Shall slapformat alter network configuration [default: True]"
),
Option
(
'--now'
,
Option
(
'--now'
,
help
=
"Launch slapformat without delay"
,
help
=
"Launch slapformat without delay"
,
default
=
False
,
default
=
False
,
action
=
"store_true"
),
action
=
"store_true"
),
...
@@ -1138,7 +1138,7 @@ class Config(object):
...
@@ -1138,7 +1138,7 @@ class Config(object):
root_needed
=
True
root_needed
=
True
else
:
else
:
root_needed
=
False
root_needed
=
False
# check root
# check root
if
root_needed
and
os
.
getuid
()
!=
0
:
if
root_needed
and
os
.
getuid
()
!=
0
:
message
=
"Root rights are needed"
message
=
"Root rights are needed"
...
...
slapos/grid/SlapObject.py
View file @
d2d044d4
...
@@ -123,7 +123,7 @@ class Software(object):
...
@@ -123,7 +123,7 @@ class Software(object):
self
.
shadir_cert_file
,
self
.
shadir_cert_file
,
self
.
shadir_key_file
)
self
.
shadir_key_file
)
shutil
.
rmtree
(
cache_dir
)
shutil
.
rmtree
(
cache_dir
)
def
_install_from_buildout
(
self
):
def
_install_from_buildout
(
self
):
""" Fetches buildout configuration from the server, run buildout with
""" Fetches buildout configuration from the server, run buildout with
it. If it fails, we notify the server.
it. If it fails, we notify the server.
...
...
slapos/grid/__init__.py
View file @
d2d044d4
...
@@ -24,4 +24,4 @@
...
@@ -24,4 +24,4 @@
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
\ No newline at end of file
slapos/grid/slapgrid.py
View file @
d2d044d4
...
@@ -368,7 +368,9 @@ class Slapgrid(object):
...
@@ -368,7 +368,9 @@ class Slapgrid(object):
shacache_key_file
=
None
,
shacache_key_file
=
None
,
shadir_cert_file
=
None
,
shadir_cert_file
=
None
,
shadir_key_file
=
None
,
shadir_key_file
=
None
,
develop
=
False
):
develop
=
False
,
software_release_filter_list
=
None
,
computer_partition_filter_list
=
None
):
"""Makes easy initialisation of class parameters"""
"""Makes easy initialisation of class parameters"""
# Parses arguments
# Parses arguments
self
.
software_root
=
os
.
path
.
abspath
(
software_root
)
self
.
software_root
=
os
.
path
.
abspath
(
software_root
)
...
@@ -721,7 +723,7 @@ class Slapgrid(object):
...
@@ -721,7 +723,7 @@ class Slapgrid(object):
"<source></source>"
\
"<source></source>"
\
"<destination></destination>"
\
"<destination></destination>"
\
"</arrow>"
\
"</arrow>"
\
%
(
strftime
(
"%Y-%m-%d at %H:%M:%S"
),
%
(
strftime
(
"%Y-%m-%d at %H:%M:%S"
),
self
.
computer_id
)
self
.
computer_id
)
for
computer_partition_usage
in
computer_partition_usage_list
:
for
computer_partition_usage
in
computer_partition_usage_list
:
...
@@ -747,7 +749,7 @@ class Slapgrid(object):
...
@@ -747,7 +749,7 @@ class Slapgrid(object):
xml_movements
+=
"<%s>%s</%s>"
%
(
children
.
tag
,
computer_partition_usage
.
getId
(),
children
.
tag
)
xml_movements
+=
"<%s>%s</%s>"
%
(
children
.
tag
,
computer_partition_usage
.
getId
(),
children
.
tag
)
else
:
else
:
xml_movements
+=
"<%s>%s</%s>"
%
(
children
.
tag
,
children
.
text
,
children
.
tag
)
xml_movements
+=
"<%s>%s</%s>"
%
(
children
.
tag
,
children
.
text
,
children
.
tag
)
xml_movements
+=
"</movement>"
xml_movements
+=
"</movement>"
xml_foot
=
"</transaction>"
\
xml_foot
=
"</transaction>"
\
"</journal>"
"</journal>"
...
@@ -772,7 +774,7 @@ class Slapgrid(object):
...
@@ -772,7 +774,7 @@ class Slapgrid(object):
except
IOError
:
except
IOError
:
computer_consumption_model
=
\
computer_consumption_model
=
\
pkg_resources
.
resource_string
(
pkg_resources
.
resource_string
(
__name__
,
__name__
,
'../../../../slapos/slap/doc/computer_consumption.xsd'
)
'../../../../slapos/slap/doc/computer_consumption.xsd'
)
try
:
try
:
...
@@ -783,7 +785,7 @@ class Slapgrid(object):
...
@@ -783,7 +785,7 @@ class Slapgrid(object):
except
IOError
:
except
IOError
:
partition_consumption_model
=
\
partition_consumption_model
=
\
pkg_resources
.
resource_string
(
pkg_resources
.
resource_string
(
__name__
,
__name__
,
'../../../../slapos/slap/doc/partition_consumption.xsd'
)
'../../../../slapos/slap/doc/partition_consumption.xsd'
)
clean_run
=
True
clean_run
=
True
...
...
slapos/slap/interface/slap.py
View file @
d2d044d4
...
@@ -52,7 +52,7 @@ class IRequester(Interface):
...
@@ -52,7 +52,7 @@ class IRequester(Interface):
slapgrid server.
slapgrid server.
"""
"""
def
request
(
software_release
,
software_type
,
partition_reference
,
def
request
(
software_release
,
software_type
,
partition_reference
,
shared
=
False
,
partition_parameter_kw
=
None
,
filter_kw
=
None
):
shared
=
False
,
partition_parameter_kw
=
None
,
filter_kw
=
None
):
"""
"""
Request software release instanciation to slapgrid server.
Request software release instanciation to slapgrid server.
...
@@ -92,13 +92,13 @@ class IBuildoutController(Interface):
...
@@ -92,13 +92,13 @@ class IBuildoutController(Interface):
def
available
():
def
available
():
"""
"""
Notify (to the slapgrid server) that the software instance is
Notify (to the slapgrid server) that the software instance is
available.
available.
"""
"""
def
building
():
def
building
():
"""
"""
Notify (to the slapgrid server) that the buildout is not
Notify (to the slapgrid server) that the buildout is not
available and under creation.
available and under creation.
"""
"""
...
@@ -146,13 +146,13 @@ class IComputerPartition(IBuildoutController, IRequester):
...
@@ -146,13 +146,13 @@ class IComputerPartition(IBuildoutController, IRequester):
def
stopped
():
def
stopped
():
"""
"""
Notify (to the slapgrid server) that the software instance is
Notify (to the slapgrid server) that the software instance is
available and stopped.
available and stopped.
"""
"""
def
started
():
def
started
():
"""
"""
Notify (to the slapgrid server) that the software instance is
Notify (to the slapgrid server) that the software instance is
available and started.
available and started.
"""
"""
...
@@ -217,7 +217,7 @@ class IComputerPartition(IBuildoutController, IRequester):
...
@@ -217,7 +217,7 @@ class IComputerPartition(IBuildoutController, IRequester):
def
getCertificate
():
def
getCertificate
():
"""
"""
Returns a dictionnary containing the authentification certificates
Returns a dictionnary containing the authentification certificates
associated to the computer partition.
associated to the computer partition.
The dictionnary keys are:
The dictionnary keys are:
key -- value is a SSL key
key -- value is a SSL key
...
@@ -273,7 +273,7 @@ class IComputer(Interface):
...
@@ -273,7 +273,7 @@ class IComputer(Interface):
installed.
installed.
"""
"""
def
getSoftwareReleaseList
():
def
getSoftwareReleaseList
():
"""
"""
Returns the list of software release which has to be supplied by the
Returns the list of software release which has to be supplied by the
computer.
computer.
...
@@ -281,7 +281,7 @@ class IComputer(Interface):
...
@@ -281,7 +281,7 @@ class IComputer(Interface):
Raise an INotFoundError if computer_guid doesn't exist.
Raise an INotFoundError if computer_guid doesn't exist.
"""
"""
def
getComputerPartitionList
():
def
getComputerPartitionList
():
"""
"""
Returns the list of configured computer partitions associated to this
Returns the list of configured computer partitions associated to this
computer.
computer.
...
@@ -291,7 +291,7 @@ class IComputer(Interface):
...
@@ -291,7 +291,7 @@ class IComputer(Interface):
def
reportUsage
(
computer_partition_list
):
def
reportUsage
(
computer_partition_list
):
"""
"""
Report the computer usage to the slapgrid server.
Report the computer usage to the slapgrid server.
IComputerPartition.setUsage has to be called on each computer partition to
IComputerPartition.setUsage has to be called on each computer partition to
define each usage.
define each usage.
...
@@ -338,7 +338,7 @@ class ISupply(Interface):
...
@@ -338,7 +338,7 @@ class ISupply(Interface):
software_release -- uri of the software release
software_release -- uri of the software release
which has to be instanciated
which has to be instanciated
computer_guid -- the identifier of the computer inside the slapgrid
computer_guid -- the identifier of the computer inside the slapgrid
server.
server.
"""
"""
...
@@ -346,7 +346,7 @@ class slap(Interface):
...
@@ -346,7 +346,7 @@ class slap(Interface):
"""
"""
Initialise slap connection to the slapgrid server
Initialise slap connection to the slapgrid server
Slapgrid server URL is defined during the slap library installation,
Slapgrid server URL is defined during the slap library installation,
as recipes should not use another server.
as recipes should not use another server.
"""
"""
...
@@ -374,7 +374,7 @@ class slap(Interface):
...
@@ -374,7 +374,7 @@ class slap(Interface):
computer_guid -- the identifier of the computer inside the slapgrid server.
computer_guid -- the identifier of the computer inside the slapgrid server.
partition_id -- the identifier of the computer partition inside the
partition_id -- the identifier of the computer partition inside the
slapgrid server.
slapgrid server.
Raise an INotFoundError if computer_guid doesn't exist.
Raise an INotFoundError if computer_guid doesn't exist.
...
@@ -391,8 +391,8 @@ class slap(Interface):
...
@@ -391,8 +391,8 @@ class slap(Interface):
"""
"""
Instanciate an open order in the slap library.
Instanciate an open order in the slap library.
"""
"""
def
registerSupply
():
def
registerSupply
():
"""
"""
Instanciate a supply in the slap library.
Instanciate a supply in the slap library.
"""
"""
slapos/slap/slap.py
View file @
d2d044d4
...
@@ -107,17 +107,17 @@ class SoftwareRelease(SlapDocument):
...
@@ -107,17 +107,17 @@ class SoftwareRelease(SlapDocument):
def
available
(
self
):
def
available
(
self
):
self
.
_connection_helper
.
POST
(
'/availableSoftwareRelease'
,
{
self
.
_connection_helper
.
POST
(
'/availableSoftwareRelease'
,
{
'url'
:
self
.
_software_release
,
'url'
:
self
.
_software_release
,
'computer_id'
:
self
.
_computer_guid
})
'computer_id'
:
self
.
_computer_guid
})
def
building
(
self
):
def
building
(
self
):
self
.
_connection_helper
.
POST
(
'/buildingSoftwareRelease'
,
{
self
.
_connection_helper
.
POST
(
'/buildingSoftwareRelease'
,
{
'url'
:
self
.
_software_release
,
'url'
:
self
.
_software_release
,
'computer_id'
:
self
.
_computer_guid
})
'computer_id'
:
self
.
_computer_guid
})
def
destroyed
(
self
):
def
destroyed
(
self
):
self
.
_connection_helper
.
POST
(
'/destroyedSoftwareRelease'
,
{
self
.
_connection_helper
.
POST
(
'/destroyedSoftwareRelease'
,
{
'url'
:
self
.
_software_release
,
'url'
:
self
.
_software_release
,
'computer_id'
:
self
.
_computer_guid
})
'computer_id'
:
self
.
_computer_guid
})
def
getState
(
self
):
def
getState
(
self
):
...
@@ -230,7 +230,7 @@ def _syncComputerInformation(func):
...
@@ -230,7 +230,7 @@ def _syncComputerInformation(func):
for
computer_partition
in
self
.
getComputerPartitionList
():
for
computer_partition
in
self
.
getComputerPartitionList
():
setattr
(
computer_partition
,
'_synced'
,
True
)
setattr
(
computer_partition
,
'_synced'
,
True
)
return
func
(
self
,
*
args
,
**
kw
)
return
func
(
self
,
*
args
,
**
kw
)
return
decorated
return
decorated
class
Computer
(
SlapDocument
):
class
Computer
(
SlapDocument
):
...
@@ -532,7 +532,7 @@ class ComputerPartition(SlapDocument):
...
@@ -532,7 +532,7 @@ class ComputerPartition(SlapDocument):
# result = func(self, *args, **kw)
# result = func(self, *args, **kw)
# setattr(self, key, result)
# setattr(self, key, result)
# return result
# return result
# return decorated
# return decorated
class
ConnectionHelper
:
class
ConnectionHelper
:
error_message_timeout
=
"
\
n
The connection timed out. Please try again later."
error_message_timeout
=
"
\
n
The connection timed out. Please try again later."
...
...
slapos/tests/slap.py
View file @
d2d044d4
...
@@ -82,7 +82,7 @@ class TestSlap(SlapMixin):
...
@@ -82,7 +82,7 @@ class TestSlap(SlapMixin):
def
test_slap_initialisation
(
self
):
def
test_slap_initialisation
(
self
):
"""
"""
Asserts that slap initialisation works properly in case of
Asserts that slap initialisation works properly in case of
passing correct url
passing correct url
"""
"""
slap_instance
=
slapos
.
slap
.
slap
()
slap_instance
=
slapos
.
slap
.
slap
()
...
@@ -92,17 +92,17 @@ class TestSlap(SlapMixin):
...
@@ -92,17 +92,17 @@ class TestSlap(SlapMixin):
def
test_slap_initialisation_wrong_url
(
self
):
def
test_slap_initialisation_wrong_url
(
self
):
"""
"""
Asserts that slap initialisation raises exception when passed url
Asserts that slap initialisation raises exception when passed url
is not correct
is not correct
"""
"""
server_url
=
'https://user:pass@server/path/path?parameter=notAcceptable'
server_url
=
'https://user:pass@server/path/path?parameter=notAcceptable'
slap_instance
=
slapos
.
slap
.
slap
()
slap_instance
=
slapos
.
slap
.
slap
()
self
.
assertRaises
(
AttributeError
,
self
.
assertRaises
(
AttributeError
,
slap_instance
.
initializeConnection
,
server_url
)
slap_instance
.
initializeConnection
,
server_url
)
def
test_registerComputer_with_new_guid
(
self
):
def
test_registerComputer_with_new_guid
(
self
):
"""
"""
Asserts that calling slap.registerComputer with new guid returns
Asserts that calling slap.registerComputer with new guid returns
Computer object
Computer object
"""
"""
computer_guid
=
self
.
_getTestComputerId
()
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -113,7 +113,7 @@ class TestSlap(SlapMixin):
...
@@ -113,7 +113,7 @@ class TestSlap(SlapMixin):
def
test_registerComputer_with_existing_guid
(
self
):
def
test_registerComputer_with_existing_guid
(
self
):
"""
"""
Asserts that calling slap.registerComputer with already used guid
Asserts that calling slap.registerComputer with already used guid
returns Computer object
returns Computer object
"""
"""
computer_guid
=
self
.
_getTestComputerId
()
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -129,7 +129,7 @@ class TestSlap(SlapMixin):
...
@@ -129,7 +129,7 @@ class TestSlap(SlapMixin):
# SoftwareRelease is currently used as suboject of Slap transmission object
# SoftwareRelease is currently used as suboject of Slap transmission object
def
test_registerSoftwareRelease_with_new_uri
(
self
):
def
test_registerSoftwareRelease_with_new_uri
(
self
):
"""
"""
Asserts that calling slap.registerSoftwareRelease with new guid
Asserts that calling slap.registerSoftwareRelease with new guid
returns SoftwareRelease object
returns SoftwareRelease object
"""
"""
software_release_uri
=
'http://server/'
+
self
.
_getTestComputerId
()
software_release_uri
=
'http://server/'
+
self
.
_getTestComputerId
()
...
@@ -141,7 +141,7 @@ class TestSlap(SlapMixin):
...
@@ -141,7 +141,7 @@ class TestSlap(SlapMixin):
def
test_registerSoftwareRelease_with_existing_uri
(
self
):
def
test_registerSoftwareRelease_with_existing_uri
(
self
):
"""
"""
Asserts that calling slap.registerSoftwareRelease with already
Asserts that calling slap.registerSoftwareRelease with already
used guid returns SoftwareRelease object
used guid returns SoftwareRelease object
"""
"""
software_release_uri
=
'http://server/'
+
self
.
_getTestComputerId
()
software_release_uri
=
'http://server/'
+
self
.
_getTestComputerId
()
...
@@ -157,7 +157,7 @@ class TestSlap(SlapMixin):
...
@@ -157,7 +157,7 @@ class TestSlap(SlapMixin):
def
test_registerComputerPartition_new_partition_id_known_computer_guid
(
self
):
def
test_registerComputerPartition_new_partition_id_known_computer_guid
(
self
):
"""
"""
Asserts that calling slap.registerComputerPartition on known computer
Asserts that calling slap.registerComputerPartition on known computer
returns ComputerPartition object
returns ComputerPartition object
"""
"""
self
.
computer_guid
=
self
.
_getTestComputerId
()
self
.
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -166,13 +166,13 @@ class TestSlap(SlapMixin):
...
@@ -166,13 +166,13 @@ class TestSlap(SlapMixin):
self
.
partition_id
=
'PARTITION_01'
self
.
partition_id
=
'PARTITION_01'
self
.
slap
.
registerComputer
(
self
.
computer_guid
)
self
.
slap
.
registerComputer
(
self
.
computer_guid
)
partition
=
self
.
slap
.
registerComputerPartition
(
self
.
computer_guid
,
partition
=
self
.
slap
.
registerComputerPartition
(
self
.
computer_guid
,
self
.
partition_id
)
self
.
partition_id
)
self
.
assertTrue
(
isinstance
(
partition
,
slapos
.
slap
.
ComputerPartition
))
self
.
assertTrue
(
isinstance
(
partition
,
slapos
.
slap
.
ComputerPartition
))
def
test_registerComputerPartition_existing_partition_id_known_computer_guid
(
self
):
def
test_registerComputerPartition_existing_partition_id_known_computer_guid
(
self
):
"""
"""
Asserts that calling slap.registerComputerPartition on known computer
Asserts that calling slap.registerComputerPartition on known computer
returns ComputerPartition object
returns ComputerPartition object
"""
"""
self
.
test_registerComputerPartition_new_partition_id_known_computer_guid
()
self
.
test_registerComputerPartition_new_partition_id_known_computer_guid
()
...
@@ -182,7 +182,7 @@ class TestSlap(SlapMixin):
...
@@ -182,7 +182,7 @@ class TestSlap(SlapMixin):
def
test_registerComputerPartition_unknown_computer_guid
(
self
):
def
test_registerComputerPartition_unknown_computer_guid
(
self
):
"""
"""
Asserts that calling slap.registerComputerPartition on unknown
Asserts that calling slap.registerComputerPartition on unknown
computer raises (not defined yet) exception
computer raises (not defined yet) exception
"""
"""
computer_guid
=
self
.
_getTestComputerId
()
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -212,7 +212,7 @@ class TestComputer(SlapMixin):
...
@@ -212,7 +212,7 @@ class TestComputer(SlapMixin):
def
test_computer_getComputerPartitionList_only_partition
(
self
):
def
test_computer_getComputerPartitionList_only_partition
(
self
):
"""
"""
Asserts that calling Computer.getComputerPartitionList with only
Asserts that calling Computer.getComputerPartitionList with only
Computer Partitions returns empty list
Computer Partitions returns empty list
"""
"""
self
.
computer_guid
=
self
.
_getTestComputerId
()
self
.
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -226,7 +226,7 @@ class TestComputer(SlapMixin):
...
@@ -226,7 +226,7 @@ class TestComputer(SlapMixin):
def
test_computer_reportUsage_non_valid_xml_raises
(
self
):
def
test_computer_reportUsage_non_valid_xml_raises
(
self
):
"""
"""
Asserts that calling Computer.reportUsage with non DTD
Asserts that calling Computer.reportUsage with non DTD
(not defined yet) XML raises (not defined yet) exception
(not defined yet) XML raises (not defined yet) exception
"""
"""
self
.
computer_guid
=
self
.
_getTestComputerId
()
self
.
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -241,7 +241,7 @@ class TestComputer(SlapMixin):
...
@@ -241,7 +241,7 @@ class TestComputer(SlapMixin):
def
test_computer_reportUsage_valid_xml_invalid_partition_raises
(
self
):
def
test_computer_reportUsage_valid_xml_invalid_partition_raises
(
self
):
"""
"""
Asserts that calling Computer.reportUsage with DTD (not defined
Asserts that calling Computer.reportUsage with DTD (not defined
yet) XML which refers to invalid partition raises (not defined yet)
yet) XML which refers to invalid partition raises (not defined yet)
exception
exception
"""
"""
...
@@ -430,7 +430,7 @@ class TestComputerPartition(SlapMixin):
...
@@ -430,7 +430,7 @@ class TestComputerPartition(SlapMixin):
def
_test_new_computer_partition_state
(
self
,
state
):
def
_test_new_computer_partition_state
(
self
,
state
):
"""
"""
Helper method to automate assertions of failing states on new Computer
Helper method to automate assertions of failing states on new Computer
Partition
Partition
"""
"""
self
.
computer_guid
=
self
.
_getTestComputerId
()
self
.
computer_guid
=
self
.
_getTestComputerId
()
...
@@ -444,28 +444,28 @@ class TestComputerPartition(SlapMixin):
...
@@ -444,28 +444,28 @@ class TestComputerPartition(SlapMixin):
def
test_available_new_ComputerPartition_raises
(
self
):
def
test_available_new_ComputerPartition_raises
(
self
):
"""
"""
Asserts that calling ComputerPartition.available on new partition
Asserts that calling ComputerPartition.available on new partition
raises (not defined yet) exception
raises (not defined yet) exception
"""
"""
self
.
_test_new_computer_partition_state
(
'available'
)
self
.
_test_new_computer_partition_state
(
'available'
)
def
test_building_new_ComputerPartition_raises
(
self
):
def
test_building_new_ComputerPartition_raises
(
self
):
"""
"""
Asserts that calling ComputerPartition.building on new partition raises
Asserts that calling ComputerPartition.building on new partition raises
(not defined yet) exception
(not defined yet) exception
"""
"""
self
.
_test_new_computer_partition_state
(
'building'
)
self
.
_test_new_computer_partition_state
(
'building'
)
def
test_started_new_ComputerPartition_raises
(
self
):
def
test_started_new_ComputerPartition_raises
(
self
):
"""
"""
Asserts that calling ComputerPartition.started on new partition raises
Asserts that calling ComputerPartition.started on new partition raises
(not defined yet) exception
(not defined yet) exception
"""
"""
self
.
_test_new_computer_partition_state
(
'started'
)
self
.
_test_new_computer_partition_state
(
'started'
)
def
test_stopped_new_ComputerPartition_raises
(
self
):
def
test_stopped_new_ComputerPartition_raises
(
self
):
"""
"""
Asserts that calling ComputerPartition.stopped on new partition raises
Asserts that calling ComputerPartition.stopped on new partition raises
(not defined yet) exception
(not defined yet) exception
"""
"""
self
.
_test_new_computer_partition_state
(
'stopped'
)
self
.
_test_new_computer_partition_state
(
'stopped'
)
...
@@ -490,7 +490,7 @@ class TestSoftwareRelease(SlapMixin):
...
@@ -490,7 +490,7 @@ class TestSoftwareRelease(SlapMixin):
def
_test_new_software_release_state
(
self
,
state
):
def
_test_new_software_release_state
(
self
,
state
):
"""
"""
Helper method to automate assertions of failing states on new Software
Helper method to automate assertions of failing states on new Software
Release
Release
"""
"""
self
.
software_release_uri
=
'http://server/'
+
self
.
_getTestComputerId
()
self
.
software_release_uri
=
'http://server/'
+
self
.
_getTestComputerId
()
...
@@ -503,14 +503,14 @@ class TestSoftwareRelease(SlapMixin):
...
@@ -503,14 +503,14 @@ class TestSoftwareRelease(SlapMixin):
def
test_available_new_SoftwareRelease_raises
(
self
):
def
test_available_new_SoftwareRelease_raises
(
self
):
"""
"""
Asserts that calling SoftwareRelease.available on new software release
Asserts that calling SoftwareRelease.available on new software release
raises (not defined yet) exception
raises (not defined yet) exception
"""
"""
self
.
_test_new_software_release_state
(
'available'
)
self
.
_test_new_software_release_state
(
'available'
)
def
test_building_new_SoftwareRelease_raises
(
self
):
def
test_building_new_SoftwareRelease_raises
(
self
):
"""
"""
Asserts that calling SoftwareRelease.building on new software release
Asserts that calling SoftwareRelease.building on new software release
raises (not defined yet) exception
raises (not defined yet) exception
"""
"""
self
.
_test_new_software_release_state
(
'building'
)
self
.
_test_new_software_release_state
(
'building'
)
...
...
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