2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
Sleep task
|
|
|
|
"""
|
2013-07-19 18:26:58 +00:00
|
|
|
import logging
|
|
|
|
import time
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2013-09-26 15:47:43 +00:00
|
|
|
|
2013-07-19 18:26:58 +00:00
|
|
|
def task(ctx, config):
|
|
|
|
"""
|
|
|
|
Sleep for some number of seconds.
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- install:
|
|
|
|
- ceph:
|
|
|
|
- sleep:
|
|
|
|
duration: 10
|
|
|
|
- interactive:
|
|
|
|
|
2013-10-12 08:28:27 +00:00
|
|
|
:param ctx: Context
|
|
|
|
:param config: Configuration
|
2013-07-19 18:26:58 +00:00
|
|
|
"""
|
|
|
|
if not config:
|
|
|
|
config = {}
|
|
|
|
assert isinstance(config, dict)
|
|
|
|
duration = int(config.get('duration', 5))
|
|
|
|
log.info('Sleeping for %d', duration)
|
|
|
|
time.sleep(duration)
|