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
241c1199
Commit
241c1199
authored
Aug 15, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "New feature: get net drive usage report from slave node."
This reverts commit
7fe0677c
.
parent
874f11bc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
99 deletions
+0
-99
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+0
-58
slapos/slap/doc/netdrive_usage.xsd
slapos/slap/doc/netdrive_usage.xsd
+0
-37
slapos/slap/slap.py
slapos/slap/slap.py
+0
-4
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
241c1199
...
@@ -699,64 +699,6 @@ class SlapTool(BaseTool):
...
@@ -699,64 +699,6 @@ class SlapTool(BaseTool):
self
.
REQUEST
.
response
.
setBody
(
result
)
self
.
REQUEST
.
response
.
setBody
(
result
)
return
self
.
REQUEST
.
response
return
self
.
REQUEST
.
response
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'reportNetDriveUsageFromXML'
)
def
reportNetDriveUsageFromXML
(
self
,
xml
):
"Generate sale packing list from net drive usage report"
#We retrieve XSD model
try
:
netdrive_usage_model
=
\
pkg_resources
.
resource_string
(
'slapos.slap'
,
'doc/netdrive_usage.xsd'
)
except
IOError
:
netdrive_usage_model
=
\
pkg_resources
.
resource_string
(
__name__
,
'../../../../slapos/slap/doc/netdrive_usage.xsd'
)
if
not
self
.
_validateXML
(
xml
,
netdrive_usage_model
):
raise
NotImplementedError
(
'XML file sent by the node is not valid !'
)
splm
=
self
.
getPortalObject
().
getDefaultModule
(
'Sale Packing List'
)
computer_id
=
''
# Insert one line
root
=
etree
.
XML
(
xml
)
for
element
in
root
.
iter
(
'item'
):
if
not
computer_id
==
element
[
0
].
text
:
computer_id
=
element
[
0
].
text
computer
=
self
.
_getComputerDocument
(
computer_id
)
domain_account
=
element
[
1
].
text
report_date
=
element
[
2
].
text
usage_amount
=
element
[
3
].
text
# Search sale packing list by domain_account and the month of report_date
year
,
month
,
day
=
report_date
.
split
(
'-'
)
reference
=
"NetDriveUsage-%s-%d.%d"
%
(
domain_account
,
year
,
month
)
spl
=
splm
.
searchFolder
(
reference
=
reference
)
if
spl
is
None
:
spl
=
splm
.
newContent
(
portal_type
=
'Sale Packing List'
,
title
=
'Net Drive Usage - %s'
%
domain_account
,
reference
=
reference
,
source_value
=
'Net Drive'
,
destination_value
=
domain_account
,
start_date
=
DateTime
(
year
,
month
,
1
),
)
spl
.
newContent
(
portal_type
=
'Sale Packing List Line'
,
resource_value
=
sequence
.
get
(
'resource'
),
delivery_date
=
report_date
,
resource_value
=
computer_id
,
quantity
=
usage_amount
)
# step through all steps of packing list workflow
# spl.confirm()
# spl.setReady()
# spl.start()
# spl.stop()
# spl.deliver()
return
'Content properly posted.'
####################################################
####################################################
# Internal methods
# Internal methods
####################################################
####################################################
...
...
slapos/slap/doc/netdrive_usage.xsd
deleted
100644 → 0
View file @
874f11bc
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
>
<xs:element
name=
"report"
>
<xs:complexType>
<xs:sequence>
<xs:element
ref=
"item"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element
name=
"item"
>
<xs:complexType>
<xs:sequence>
<xs:element
name=
"computer"
type=
"xs:string"
/>
<xs:element
name=
"account"
type=
"xs:string"
/>
<xs:element
name=
"date"
type=
"xs:date"
/>
<xs:element
name=
"usage"
type=
"xs:decimal"
/>
<xs:element
ref=
"details"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element
name=
"details"
>
<xs:complexType>
<xs:element
ref=
"line"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</xs:complexType>
</xs:element>
<xs:element
name=
"line"
>
<xs:complexType>
<xs:all>
<xs:element
name=
"drive"
type=
"xs:string"
/>
<xs:element
name=
"remote"
type=
"xs:string"
/>
<xs:element
name=
"start"
type=
"xs:time"
/>
<xs:element
name=
"duration"
type=
"xs:integer"
/>
<xs:element
name=
"bytes"
type=
"xs:integer"
/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
slapos/slap/slap.py
View file @
241c1199
...
@@ -345,10 +345,6 @@ class Computer(SlapDocument):
...
@@ -345,10 +345,6 @@ class Computer(SlapDocument):
'computer_id'
:
self
.
_computer_id
})
'computer_id'
:
self
.
_computer_id
})
return
xml_marshaller
.
loads
(
xml
)
return
xml_marshaller
.
loads
(
xml
)
def
reportNetDriveUsage
(
self
,
xml
):
self
.
_connection_helper
.
POST
(
'/reportNetDriveUsageFromXML'
,
{
'xml'
:
xml
})
return
self
.
_connection_helper
.
response
.
read
()
def
parsed_error_message
(
status
,
body
,
path
):
def
parsed_error_message
(
status
,
body
,
path
):
m
=
re
.
search
(
'(Error Value:
\
n
.*)'
,
body
,
re
.
MULTILINE
)
m
=
re
.
search
(
'(Error Value:
\
n
.*)'
,
body
,
re
.
MULTILINE
)
...
...
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