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
Arnaud Véron
slapos.core
Commits
833e4782
Commit
833e4782
authored
Oct 29, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos/collect: getint don't support fallback
parent
9d796b73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
slapos/collect/__init__.py
slapos/collect/__init__.py
+6
-4
No files found.
slapos/collect/__init__.py
View file @
833e4782
...
@@ -89,8 +89,10 @@ def do_collect(conf):
...
@@ -89,8 +89,10 @@ def do_collect(conf):
user_dict
[
snapshot
.
username
].
append
(
snapshot
)
user_dict
[
snapshot
.
username
].
append
(
snapshot
)
except
(
KeyboardInterrupt
,
SystemExit
,
NoSuchProcess
):
except
(
KeyboardInterrupt
,
SystemExit
,
NoSuchProcess
):
raise
raise
days_to_preserve
=
15
days_to_preserve
=
conf
.
getint
(
"slapos"
,
"collect_cache"
,
15
)
if
conf
.
has_option
(
"slapos"
,
"collect_cache"
):
days_to_preserve
=
conf
.
getint
(
"slapos"
,
"collect_cache"
)
log_directory
=
"%s/var/data-log"
%
conf
.
get
(
"slapos"
,
"instance_root"
)
log_directory
=
"%s/var/data-log"
%
conf
.
get
(
"slapos"
,
"instance_root"
)
mkdir_p
(
log_directory
,
0o755
)
mkdir_p
(
log_directory
,
0o755
)
...
@@ -149,7 +151,7 @@ def do_collect(conf):
...
@@ -149,7 +151,7 @@ def do_collect(conf):
base
=
datetime
.
datetime
.
utcnow
().
date
()
base
=
datetime
.
datetime
.
utcnow
().
date
()
for
x
in
range
(
1
,
3
):
for
x
in
range
(
1
,
3
):
report_file
=
consumption_report
.
buildXMLReport
(
report_file
=
consumption_report
.
buildXMLReport
(
(
base
-
datetime
.
timedelta
(
days
=
x
)).
strftime
(
"%Y-%m-%d"
)
,
gmtime
()
)
(
base
-
datetime
.
timedelta
(
days
=
x
)).
strftime
(
"%Y-%m-%d"
))
if
report_file
is
not
None
:
if
report_file
is
not
None
:
shutil
.
copy
(
report_file
,
xml_report_directory
)
shutil
.
copy
(
report_file
,
xml_report_directory
)
...
@@ -162,7 +164,7 @@ def do_collect(conf):
...
@@ -162,7 +164,7 @@ def do_collect(conf):
compressLogFolder
(
log_directory
)
compressLogFolder
(
log_directory
)
# Drop older entries already reported
# Drop older entries already reported
database
.
garbageCollect
(
int
(
days_to_preserve
))
database
.
garbageCollect
(
days_to_preserve
)
except
AccessDenied
:
except
AccessDenied
:
print
(
"You HAVE TO execute this script with root permission."
)
print
(
"You HAVE TO execute this script with root permission."
)
...
...
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