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
Lu Xu
slapos.core
Commits
0f11b6d1
Commit
0f11b6d1
authored
Sep 11, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify status when computer, instance access SlapTool.
parent
96311200
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+29
-2
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
0f11b6d1
...
@@ -66,6 +66,9 @@ import xml_marshaller
...
@@ -66,6 +66,9 @@ import xml_marshaller
import
StringIO
import
StringIO
import
pkg_resources
import
pkg_resources
from
Products.Vifib.Conduit
import
VifibConduit
from
Products.Vifib.Conduit
import
VifibConduit
import
json
from
DateTime
import
DateTime
from
App.Common
import
rfc1123_date
class
SoftwareInstanceNotReady
(
Exception
):
class
SoftwareInstanceNotReady
(
Exception
):
pass
pass
...
@@ -166,6 +169,7 @@ class SlapTool(BaseTool):
...
@@ -166,6 +169,7 @@ class SlapTool(BaseTool):
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
self
.
_logAccess
(
user
,
user
,
'#access %s'
%
computer_id
)
return
CachingMethod
(
_getComputerInformation
,
return
CachingMethod
(
_getComputerInformation
,
id
=
'_getComputerInformation'
,
id
=
'_getComputerInformation'
,
cache_factory
=
'slap_cache_factory'
)(
computer_id
,
user
)
cache_factory
=
'slap_cache_factory'
)(
computer_id
,
user
)
...
@@ -201,6 +205,7 @@ class SlapTool(BaseTool):
...
@@ -201,6 +205,7 @@ class SlapTool(BaseTool):
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
self
.
_logAccess
(
user
,
user
,
'#access %s'
%
computer_id
)
return
CachingMethod
(
_getFullComputerInformation
,
return
CachingMethod
(
_getFullComputerInformation
,
id
=
'_getFullComputerInformation'
,
id
=
'_getFullComputerInformation'
,
cache_factory
=
'slap_cache_factory'
)(
computer_id
,
user
)
cache_factory
=
'slap_cache_factory'
)(
computer_id
,
user
)
...
@@ -276,6 +281,9 @@ class SlapTool(BaseTool):
...
@@ -276,6 +281,9 @@ class SlapTool(BaseTool):
"""
"""
Add an error for a software Release workflow
Add an error for a software Release workflow
"""
"""
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
()
\
.
getUserName
()
self
.
_logAccess
(
user
,
computer_id
,
'#error while installing %s'
%
url
)
return
self
.
_softwareReleaseError
(
url
,
computer_id
,
error_log
)
return
self
.
_softwareReleaseError
(
url
,
computer_id
,
error_log
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
...
@@ -511,6 +519,20 @@ class SlapTool(BaseTool):
...
@@ -511,6 +519,20 @@ class SlapTool(BaseTool):
# Internal methods
# Internal methods
####################################################
####################################################
def
_getMemcachedDict
(
self
):
return
self
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
def
_logAccess
(
self
,
user_reference
,
context_reference
,
text
):
memcached_dict
=
self
.
_getMemcachedDict
()
value
=
json
.
dumps
({
'user'
:
'%s'
%
user_reference
,
'created_at'
:
'%s'
%
rfc1123_date
(
DateTime
()),
'text'
:
'%s'
%
text
,
})
memcached_dict
[
context_reference
]
=
value
def
_validateXML
(
self
,
to_be_validated
,
xsd_model
):
def
_validateXML
(
self
,
to_be_validated
,
xsd_model
):
"""Will validate the xml file"""
"""Will validate the xml file"""
#We parse the XSD model
#We parse the XSD model
...
@@ -704,9 +726,14 @@ class SlapTool(BaseTool):
...
@@ -704,9 +726,14 @@ class SlapTool(BaseTool):
"""
"""
Add an error for the software Instance Workflow
Add an error for the software Instance Workflow
"""
"""
return
self
.
_getSoftwareInstanceForComputerPartition
(
instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
computer_id
,
computer_id
,
computer_partition_id
).
reportComputerPartitionError
(
computer_partition_id
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
()
\
.
getUserName
()
self
.
_logAccess
(
user
,
instance
.
getReference
(),
'#error while instanciating'
)
return
instance
.
reportComputerPartitionError
(
comment
=
error_log
)
comment
=
error_log
)
@
convertToREST
@
convertToREST
...
...
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