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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
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
Hide 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