Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
872a2559
Commit
872a2559
authored
Sep 13, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if attributes are not null before doing anything.
parent
ea9da85d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
slapos/slap/slap.py
slapos/slap/slap.py
+20
-8
No files found.
slapos/slap/slap.py
View file @
872a2559
...
@@ -96,11 +96,23 @@ class SoftwareRelease(SlapDocument):
...
@@ -96,11 +96,23 @@ class SoftwareRelease(SlapDocument):
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
_software_release
,
self
.
_computer_guid
,
)
return
(
self
.
_software_release
,
self
.
_computer_guid
,
)
def
getComputerId
(
self
):
if
not
self
.
_computer_guid
:
raise
NameError
(
'computer_guid has not been defined.'
)
else
:
return
self
.
_computer_guid
def
getURI
(
self
):
if
not
self
.
_software_release
:
raise
NameError
(
'software_release has not been defined.'
)
else
:
return
self
.
_software_release
def
error
(
self
,
error_log
):
def
error
(
self
,
error_log
):
# Does not follow interface
# Does not follow interface
self
.
_connection_helper
.
POST
(
'/softwareReleaseError'
,
{
self
.
_connection_helper
.
POST
(
'/softwareReleaseError'
,
{
'url'
:
self
.
_software_release
,
'url'
:
self
.
getURI
()
,
'computer_id'
:
self
.
_computer_guid
,
'computer_id'
:
self
.
getComputerId
()
,
'error_log'
:
error_log
})
'error_log'
:
error_log
})
def
getURI
(
self
):
def
getURI
(
self
):
...
@@ -108,18 +120,18 @@ class SoftwareRelease(SlapDocument):
...
@@ -108,18 +120,18 @@ 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
.
getURI
()
,
'computer_id'
:
self
.
_computer_guid
})
'computer_id'
:
self
.
getComputerId
()
})
def
building
(
self
):
def
building
(
self
):
self
.
_connection_helper
.
POST
(
'/buildingSoftwareRelease'
,
{
self
.
_connection_helper
.
POST
(
'/buildingSoftwareRelease'
,
{
'url'
:
self
.
_software_release
,
'url'
:
self
.
getURI
()
,
'computer_id'
:
self
.
_computer_guid
})
'computer_id'
:
self
.
getComputerId
()
})
def
destroyed
(
self
):
def
destroyed
(
self
):
self
.
_connection_helper
.
POST
(
'/destroyedSoftwareRelease'
,
{
self
.
_connection_helper
.
POST
(
'/destroyedSoftwareRelease'
,
{
'url'
:
self
.
_software_release
,
'url'
:
self
.
getURI
()
,
'computer_id'
:
self
.
_computer_guid
})
'computer_id'
:
self
.
getComputerId
()
})
def
getState
(
self
):
def
getState
(
self
):
return
getattr
(
self
,
'_requested_state'
,
'available'
)
return
getattr
(
self
,
'_requested_state'
,
'available'
)
...
...
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