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
Titouan Soulard
slapos.core
Commits
afc7917a
Commit
afc7917a
authored
Sep 13, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into slapgrid_test
parents
3a8c83ff
fa395f84
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1444 additions
and
302 deletions
+1444
-302
master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml
...m/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml
+4
-1
master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/SoftwareRelease_viewUsableComputerList/listbox.xml
...b_base/SoftwareRelease_viewUsableComputerList/listbox.xml
+4
-0
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/monitoring.xml
...mplateItem/web_site_module/hosting/myspace/monitoring.xml
+149
-0
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_account.xml
...mplateItem/web_site_module/hosting/myspace/my_account.xml
+1
-3
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_invoices.xml
...plateItem/web_site_module/hosting/myspace/my_invoices.xml
+4
-0
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_servers.xml
...mplateItem/web_site_module/hosting/myspace/my_servers.xml
+4
-0
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_services.xml
...plateItem/web_site_module/hosting/myspace/my_services.xml
+1
-3
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/software.xml
...TemplateItem/web_site_module/hosting/myspace/software.xml
+1
-3
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/service-shortcut/erp5.xml
...ateItem/web_site_module/hosting/service-shortcut/erp5.xml
+141
-0
master/bt5/vifib_data_web/bt/revision
master/bt5/vifib_data_web/bt/revision
+1
-1
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
.../DocumentTemplateItem/portal_components/VifibRestAPIV1.py
+64
-1
master/bt5/vifib_slapos_rest_api_v1/bt/revision
master/bt5/vifib_slapos_rest_api_v1/bt/revision
+1
-1
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
..._api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
+265
-0
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
+1
-1
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getVifibOverview.xml
...Item/portal_skins/vifib_hosting/Base_getVifibOverview.xml
+8
-7
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibERP5.xml
.../portal_skins/vifib_hosting/WebSection_orderVifibERP5.xml
+99
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring.xml
.../portal_skins/vifib_hosting/WebSection_viewMonitoring.xml
+2
-1
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring/my_section_title.xml
...ib_hosting/WebSection_viewMonitoring/my_section_title.xml
+90
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring/my_translated_description.xml
...g/WebSection_viewMonitoring/my_translated_description.xml
+90
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring/your_title.xml
...ns/vifib_hosting/WebSection_viewMonitoring/your_title.xml
+0
-275
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_image/monitoring.png.xml
...ifib_hosting_theme/vifib_hosting_image/monitoring.png.xml
+192
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_image/monitoring_active.png.xml
...sting_theme/vifib_hosting_image/monitoring_active.png.xml
+313
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_style/hosting-design.css.xml
..._hosting_theme/vifib_hosting_style/hosting-design.css.xml
+4
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_style/vifib.css.xml
.../portal_skins/vifib_jauks_theme/vifib_style/vifib.css.xml
+3
-3
master/bt5/vifib_web/bt/revision
master/bt5/vifib_web/bt/revision
+1
-1
No files found.
master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml
View file @
afc7917a
...
...
@@ -116,6 +116,9 @@ if filter_kw.keys():\n
# XXX Drop all unexpected keys\n
query_kw["uid"] = "-1"\n
\n
if test_mode:\n
return bool(len(context.portal_catalog(limit=1, **query_kw)))\n
\n
SQL_WINDOW_SIZE = 50\n
\n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n
...
...
@@ -154,7 +157,7 @@ return computer_partition.getRelativeUrl()\n
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw
</string>
</value>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw
, test_mode=False
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/SoftwareRelease_viewUsableComputerList/listbox.xml
View file @
afc7917a
...
...
@@ -104,6 +104,10 @@
<string>
free_partition
</string>
<string>
Free Partition Count
</string>
</tuple>
<tuple>
<string>
allocation_scope_translated_title
</string>
<string>
Allocation Scope
</string>
</tuple>
</list>
</value>
</item>
...
...
master/bt5/vifib_base/bt/revision
View file @
afc7917a
472
\ No newline at end of file
474
\ No newline at end of file
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/monitoring.xml
0 → 100644
View file @
afc7917a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Section"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_folders_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Copy_or_Move_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Delete_objects_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
authorization_forced
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
custom_render_method_id
</string>
</key>
<value>
<string>
WebSection_viewMonitoring
</string>
</value>
</item>
<item>
<key>
<string>
default_page_displayed
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
This page shows the status of your servers and instances
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
monitoring
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
6
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Section
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Monitoring
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_account.xml
View file @
afc7917a
...
...
@@ -103,9 +103,7 @@
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<none/>
</value>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
...
...
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_invoices.xml
View file @
afc7917a
...
...
@@ -89,6 +89,10 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
my_invoices
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Section
</string>
</value>
...
...
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_servers.xml
View file @
afc7917a
...
...
@@ -89,6 +89,10 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
my_servers
</string>
</value>
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Section
</string>
</value>
...
...
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/my_services.xml
View file @
afc7917a
...
...
@@ -85,9 +85,7 @@
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<none/>
</value>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
...
...
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/myspace/software.xml
View file @
afc7917a
...
...
@@ -95,9 +95,7 @@
</item>
<item>
<key>
<string>
int_index
</string>
</key>
<value>
<none/>
</value>
<value>
<int>
5
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
...
...
master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/service-shortcut/erp5.xml
0 → 100644
View file @
afc7917a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Section"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_folders_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Copy_or_Move_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Delete_objects_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
authorization_forced
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
custom_render_method_id
</string>
</key>
<value>
<string>
WebSection_orderVifibERP5
</string>
</value>
</item>
<item>
<key>
<string>
default_page_displayed
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Section
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
1
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_data_web/bt/revision
View file @
afc7917a
104
\ No newline at end of file
106
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
View file @
afc7917a
...
...
@@ -343,6 +343,66 @@ class InstancePublisher(GenericPublisher):
self
.
REQUEST
.
response
.
setBody
(
jsonify
({
'status'
:
'processing'
}))
return
self
.
REQUEST
.
response
@
requireHeader
({
'Content-Type'
:
'^application/json.*'
})
@
requireJson
(
dict
(
slave
=
bool
,
software_release
=
(
unicode
,
encode_utf8
),
title
=
(
unicode
,
encode_utf8
),
software_type
=
(
unicode
,
encode_utf8
),
parameter
=
(
dict
,
etreeXml
),
sla
=
(
dict
,
etreeXml
),
status
=
(
unicode
,
encode_utf8
),
))
def
__allocable
(
self
):
request_dict
=
{}
if
self
.
jbody
[
'status'
]
not
in
[
'started'
,
'stopped'
,
'destroyed'
]:
self
.
REQUEST
.
response
.
setStatus
(
400
)
self
.
REQUEST
.
response
.
setBody
(
jsonify
(
{
'status'
:
'Status shall be one of: started, stopped, destroyed.'
}))
return
self
.
REQUEST
.
response
try
:
user
=
self
.
restrictedTraverse
(
self
.
user_url
)
user_portal_type
=
user
.
getPortalType
()
if
user_portal_type
==
'Person'
:
pass
elif
user_portal_type
==
'Software Instance'
:
hosting_subscription
=
user
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
user
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
else
:
raise
NotImplementedError
,
"Can not get Person document"
open_order
=
self
.
portal_catalog
.
getResultValue
(
portal_type
=
'Open Sale Order'
,
default_destination_decision_uid
=
user
.
getUid
(),
validation_state
=
'validated'
)
tmp_instance
=
self
.
software_instance_module
.
newContent
(
portal_type
=
"Software Instance"
,
sla_xml
=
self
.
jbody
[
'sla'
],
temp_object
=
1
,
)
result
=
open_order
.
OpenSaleOrder_findPartition
(
self
.
jbody
[
'software_release'
],
self
.
jbody
[
'software_type'
],
(
'Software Instance'
,
'Slave Instance'
)[
int
(
self
.
jbody
[
'slave'
])],
tmp_instance
.
getSlaXmlAsDict
(),
test_mode
=
True
)
except
Exception
:
transaction
.
abort
()
LOG
(
'VifibRestApiV1'
,
ERROR
,
'Problem with person.allocable:'
,
error
=
True
)
self
.
REQUEST
.
response
.
setStatus
(
500
)
self
.
REQUEST
.
response
.
setBody
(
jsonify
({
'error'
:
'There is system issue, please try again later.'
}))
return
self
.
REQUEST
.
response
self
.
REQUEST
.
response
.
setStatus
(
200
)
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
'no-cache, no-store'
)
self
.
REQUEST
.
response
.
setBody
(
jsonify
({
'result'
:
result
}))
return
self
.
REQUEST
.
response
@
extractDocument
([
'Software Instance'
,
'Slave Instance'
])
@
supportModifiedSince
(
'document_url'
)
def
__instance_info
(
self
):
...
...
@@ -424,7 +484,10 @@ class InstancePublisher(GenericPublisher):
self
.
__request
()
elif
self
.
REQUEST
[
'REQUEST_METHOD'
]
==
'GET'
:
if
self
.
REQUEST
[
'traverse_subpath'
]:
self
.
__instance_info
()
if
self
.
REQUEST
[
'traverse_subpath'
][
-
1
]
==
'request'
:
self
.
__allocable
()
else
:
self
.
__instance_info
()
else
:
self
.
__instance_list
()
...
...
master/bt5/vifib_slapos_rest_api_v1/bt/revision
View file @
afc7917a
17
\ No newline at end of file
19
\ No newline at end of file
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
View file @
afc7917a
...
...
@@ -825,6 +825,271 @@ class TestInstanceGETcertificate(VifibSlaposRestAPIV1InstanceMixin):
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
404
)
class
TestInstanceAllocableGET
(
VifibSlaposRestAPIV1InstanceMixin
):
def
test_not_logged_in
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]))
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
401
)
self
.
assertTrue
(
self
.
response
.
getheader
(
'Location'
)
is
not
None
)
auth
=
self
.
response
.
getheader
(
'WWW-Authenticate'
)
self
.
assertTrue
(
auth
is
not
None
)
self
.
assertTrue
(
'Bearer realm="'
in
auth
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_no_json
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'error'
:
"Data is not json object."
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_bad_json
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
'This is not JSON'
,
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'error'
:
"Data is not json object."
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_empty_json
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
'{}'
,
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"status"
:
"Missing."
,
"slave"
:
"Missing."
,
"title"
:
"Missing."
,
"software_release"
:
"Missing."
,
"software_type"
:
"Missing."
,
"parameter"
:
"Missing."
,
"sla"
:
"Missing."
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_status_slave_missing_json
(
self
):
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
"""
{
"title": "My unique instance",
"software_release": "http://example.com/example.cfg",
"software_type": "type_provided_by_the_software",
"parameter": {
"Custom1": "one string",
"Custom2": "one float",
"Custom3": [
"abc",
"def"
]
},
"sla": {
"computer_id": "COMP-0"
}
}"""
,
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"status"
:
"Missing."
,
"slave"
:
"Missing."
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_slave_not_bool
(
self
):
kwargs
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'started'
,
'sla'
:
{
'computer_id'
:
'COMP-0'
},
'software_type'
:
'type_provided_by_the_software'
,
'slave'
:
"True"
}
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"slave"
:
"unicode is not bool."
,
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_incorrect_status
(
self
):
kwargs
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'badstatus'
,
'sla'
:
{
'computer_id'
:
'COMP-0'
},
'software_type'
:
'type_provided_by_the_software'
,
'slave'
:
True
}
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
"status"
:
"Status shall be one of: started, stopped, destroyed."
,
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
def
test_correct
(
self
):
kwargs
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'started'
,
'sla'
:
{
'computer_id'
:
'COMP-0'
},
'software_type'
:
'type_provided_by_the_software'
,
'slave'
:
True
}
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
200
)
self
.
assertResponseJson
()
def
test_additional_key_json
(
self
):
kw_request
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'started'
,
'sla'
:
{
'computer_id'
:
'COMP-0'
},
'software_type'
:
'type_provided_by_the_software'
,
'slave'
:
True
}
kwargs
=
kw_request
.
copy
()
kwargs
.
update
(
**
{
'wrong_key'
:
'Be ignored'
})
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
200
)
self
.
assertResponseJson
()
# def test_correct_server_side_raise(self):
# self.customer.requestSoftwareInstance = \
# RaisingSimulator(AttributeError)
# transaction.commit()
# kwargs = {
# 'parameter': {
# 'Custom1': 'one string',
# 'Custom2': 'one float',
# 'Custom3': ['abc', 'def']},
# 'title': 'My unique instance',
# 'software_release': 'http://example.com/example.cfg',
# 'status': 'started',
# 'sla': {
# 'computer_id': 'COMP-0'},
# 'software_type': 'type_provided_by_the_software',
# 'slave': True}
# self.connection.request(method='GET',
# url='/'.join([self.api_path, 'instance', 'request']),
# body=json.dumps(kwargs),
# headers={'REMOTE_USER': self.customer_reference})
# self.prepareResponse()
# self.assertBasicResponse()
# self.assertResponseCode(500)
# self.assertResponseJson()
# self.assertEqual({
# "error": "There is system issue, please try again later.",
# },
# self.json_response)
# self.assertPersonRequestSimulatorEmpty()
def
test_content_negotiation_headers
(
self
):
self
.
connection
=
CustomHeaderHTTPConnection
(
host
=
self
.
api_netloc
,
custom_header
=
{
'Access-Control-Request-Headers'
:
self
.
access_control_allow_headers
})
kwargs
=
{
'parameter'
:
{
'Custom1'
:
'one string'
,
'Custom2'
:
'one float'
,
'Custom3'
:
[
'abc'
,
'def'
]},
'title'
:
'My unique instance'
,
'software_release'
:
'http://example.com/example.cfg'
,
'status'
:
'started'
,
'sla'
:
{
'computer_id'
:
'COMP-0'
},
'software_type'
:
'type_provided_by_the_software'
,
'slave'
:
True
}
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'Content-Type'
:
"Header with value '^application/json.*' is required."
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
# now check with incorrect headers
self
.
connection
.
request
(
method
=
'GET'
,
url
=
'/'
.
join
([
self
.
api_path
,
'instance'
,
'request'
]),
body
=
json
.
dumps
(
kwargs
),
headers
=
{
'REMOTE_USER'
:
self
.
customer_reference
,
'Content-Type'
:
'please/complain'
,
'Accept'
:
'be/silent'
})
self
.
prepareResponse
()
self
.
assertBasicResponse
()
self
.
assertResponseCode
(
400
)
self
.
assertResponseJson
()
self
.
assertEqual
({
'Content-Type'
:
"Header with value '^application/json.*' is required."
},
self
.
json_response
)
self
.
assertPersonRequestSimulatorEmpty
()
# and with correct ones are set by default
def
VifibSlaposRestAPIV1BangMixin_afterSetUp
(
self
):
VifibSlaposRestAPIV1BangMixin_afterSetUp
(
self
)
self
.
instance_bang_simulator
=
tempfile
.
mkstemp
()[
1
]
...
...
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
afc7917a
79
\ No newline at end of file
80
\ No newline at end of file
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getVifibOverview.xml
View file @
afc7917a
...
...
@@ -120,14 +120,18 @@ encode : function (input) {\n
var created_at = new Date(Date.parse(data.created_at)),\n
now = new Date(),\n
context = $(this);\n
console.log(data[\'@document\']);
\n
if (/#ok/.test(data.text)
&
(now - created_at
< 300000
))
{\n
// 5 minute for computer. 1 day for instance.
\n
if (/#ok/.test(data.text)
&
/computer_module/.test(data[\'@document\'])
&
(now - created_at
< 300000
))
{\n
$(this).attr("class",
"monitoring_ok")\n
.attr("title",
data.text)\n
.attr("title",
data.text
+
"
("
+
created_at
+
")"
)\n
.html("<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
} else if (/#ok/.test(data.text)
&
/software_instance_module/.test(data[\'@document\'])
&
(now - created_at
< 86400000
))
{\n
$(this).attr("class",
"monitoring_ok")\n
.attr("title",
data.text
+
"
("
+
created_at
+
")"
)\n
.html("<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
} else {\n
$(this).attr("class", "monitoring_error")\n
.attr("title", data.text)\n
.attr("title", data.text
+ " (" + created_at + ")"
)\n
.html("
<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
}\n
setTimeout(function () {\n
...
...
@@ -181,9 +185,6 @@ encode : function (input) {\n
});\n
}\n
},\n
error: function(jqXHR, textStatus, errorThrown) {\n
console.log(jqXHR.status);\n
},\n
complete: function() {\n
var context = $(this);\n
setTimeout(function () {\n
...
...
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibERP5.xml
0 → 100644
View file @
afc7917a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
\n
instance_xml = """<?xml version="1.0" encoding="utf-8"?>
\n
<instance>
\n
<parameter
id=
"flavour"
>
configurator
</parameter>
\n
<parameter
id=
"frontend-software-url"
>
http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
</parameter>
\n
<parameter
id=
"frontend-instance-guid"
>
SOFTINST-9238
</parameter>
\n
</instance>
\n
"""\n
url = "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.117:/software/erp5/software.cfg"\n
software_type = "default"\n
\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
request_kw = {}\n
request_kw.update(\n
software_release=url,\n
software_title="ERP5 Instance 00-%i" % portal.portal_ids.generateNewId(id_group=("vifib", "kvm"), default=1),\n
software_type=software_type,\n
instance_xml=instance_xml,\n
sla_xml="",\n
shared=False,\n
state="started",\n
)\n
\n
person.requestSoftwareInstance(**request_kw)\n
\n
message = context.Base_translateString("Your instance is under creation. Please wait few minutes for partitions to appear.")\n
return context.REQUEST.get(\'request_hosting_subscription\').Base_redirect(keep_items={\'portal_status_message\': message})\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebSection_orderVifibERP5
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring.xml
View file @
afc7917a
...
...
@@ -95,7 +95,8 @@
<key>
<string>
normal
</string>
</key>
<value>
<list>
<string>
your_title
</string>
<string>
my_section_title
</string>
<string>
my_translated_description
</string>
<string>
your_ad
</string>
</list>
</value>
...
...
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring/my_section_title.xml
0 → 100644
View file @
afc7917a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_section_title
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_section_title
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewWebFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring/my_translated_description.xml
0 → 100644
View file @
afc7917a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_translated_description
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_translated_description
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewWebFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewMonitoring/your_title.xml
deleted
100644 → 0
View file @
3a8c83ff
This diff is collapsed.
Click to expand it.
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_image/monitoring.png.xml
0 → 100644
View file @
afc7917a
This diff is collapsed.
Click to expand it.
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_image/monitoring_active.png.xml
0 → 100644
View file @
afc7917a
This diff is collapsed.
Click to expand it.
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_style/hosting-design.css.xml
View file @
afc7917a
...
...
@@ -110,6 +110,10 @@ padding-left:100px;\n
background:url(
<tal:block
tal:replace=
"img_folder"
/>
help_active.png) no-repeat scroll left center transparent;\n
padding-left:100px;\n
}\n
.monitoring h1 {\n
background:url(
<tal:block
tal:replace=
"img_folder"
/>
monitoring_active.png) no-repeat scroll left center transparent;\n
padding-left:100px;\n
}\n
\n
#shopping_cart_renderer .listbox tr:nth-child(2n) {\n
background:none repeat scroll 0 0 #FFFFFF;\n
...
...
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_style/vifib.css.xml
View file @
afc7917a
...
...
@@ -99,7 +99,7 @@ a img{border : 0 none;cursor : pointer;}\n
#vifib_logo{position:absolute;top:2px;left:50%;margin-left:-150px;width:300px;\n
height:150px;background: url(
<tal:block
tal:replace=
"images_path"
/>
vifib_logo.png) no-repeat top left}\n
\n
#login_menu{width:
75
0px;margin:120px auto 0px auto;padding-right:20px;text-align:right;\n
#login_menu{width:
90
0px;margin:120px auto 0px auto;padding-right:20px;text-align:right;\n
\tcolor:#bae2e9;height:36px;-moz-border-radius:10px}\n
#login_menu li{display:inline;padding:23px;line-height:44px;\n
\tfont-size:16px;font-weight:bold;background:url(
<tal:block
tal:replace=
"images_path"
/>
login_bg.png) repeat-x center left}\n
...
...
@@ -108,7 +108,7 @@ a img{border : 0 none;cursor : pointer;}\n
\n
#menu li a, #login_menu li a {color:#BAE2E9;text-decoration:none;}\n
\n
#menu{width:
75
0px;margin:0px auto 0px auto;text-align:center;\n
#menu{width:
90
0px;margin:0px auto 0px auto;text-align:center;\n
\tcolor:#bae2e9;height:44px;background:url(
<tal:block
tal:replace=
"images_path"
/>
menu_bg.png) repeat-x top left;\n
\t-moz-border-radius:10px}\n
#menu ul{list-style:none}\n
...
...
@@ -122,7 +122,7 @@ a img{border : 0 none;cursor : pointer;}\n
\n
/* Global container */\n
#content{text-align:left;position:relative;\n
left:50%;margin-left:-
375px;font-size:1.2em;width:75
0px;min-height:400px;\n
left:50%;margin-left:-
450px;font-size:1.2em;width:90
0px;min-height:400px;\n
background-color:#f3fdff;-moz-border-radius:10px}\n
#content_padding{padding:20px}\n
\n
...
...
master/bt5/vifib_web/bt/revision
View file @
afc7917a
436
\ No newline at end of file
442
\ No newline at end of file
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