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
Ophélie Gagnard
slapos.core
Commits
1175ddc8
Commit
1175ddc8
authored
Jun 13, 2012
by
Cédric Le Ninivin
Committed by
Cédric de Saint Martin
Jun 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added random delay to slapformat
Delay is between 0 and 1 hour
parent
192aa7a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
slapos/format.py
slapos/format.py
+10
-0
No files found.
slapos/format.py
View file @
1175ddc8
...
@@ -867,6 +867,10 @@ class Parser(OptionParser):
...
@@ -867,6 +867,10 @@ class Parser(OptionParser):
help
=
"Shall slapformat alter user database [default: True]"
),
help
=
"Shall slapformat alter user database [default: True]"
),
Option
(
'--alter_network'
,
choices
=
[
'True'
,
'False'
],
Option
(
'--alter_network'
,
choices
=
[
'True'
,
'False'
],
help
=
"Shall slapformat alter network configuration [default: True]"
),
help
=
"Shall slapformat alter network configuration [default: True]"
),
Option
(
'--now'
,
help
=
"Launch slapformat without delay"
,
default
=
False
,
action
=
"store_true"
),
])
])
def
check_args
(
self
,
args
):
def
check_args
(
self
,
args
):
...
@@ -1209,6 +1213,12 @@ def main(*args):
...
@@ -1209,6 +1213,12 @@ def main(*args):
config
.
logger
.
debug
(
' '
.
join
(
argument_list
))
config
.
logger
.
debug
(
' '
.
join
(
argument_list
))
return
dry_callAndRead
(
argument_list
,
raise_on_error
)
return
dry_callAndRead
(
argument_list
,
raise_on_error
)
callAndRead
=
logging_callAndRead
callAndRead
=
logging_callAndRead
# Add delay between 0 and 1 hour
if
not
config
.
now
:
duration
=
float
(
60
*
60
)
*
random
.
random
()
print
(
"Sleeping for %s seconds. To disable this feature, "
\
"use with --now parameter in manual."
%
duration
)
time
.
sleep
(
duration
)
try
:
try
:
run
(
config
)
run
(
config
)
except
:
except
:
...
...
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