log = logging.getLogger(__name__)
+def filter_out_containers(cluster):
+ """
+ Returns a cluster that excludes remotes which should skip this task.
+ Currently, only skips containerized remotes.
+ """
+ return cluster.filter(lambda r: not r.is_container)
+
@contextlib.contextmanager
def task(ctx, config):
"""
"""
log.info('Syncing clocks and checking initial clock skew...')
-
+ cluster = filter_out_containers()(ctx.cluster)
run.wait(
- ctx.cluster.run(
+ cluster.run(
args = [
'sudo', 'systemctl', 'stop', 'ntp.service', run.Raw('||'),
'sudo', 'systemctl', 'stop', 'ntpd.service', run.Raw('||'),
finally:
log.info('Checking final clock skew...')
+ cluster = filter_out_containers(ctx.cluster)
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'PATH=/usr/bin:/usr/sbin', 'ntpq', '-p', run.Raw('||'),
'PATH=/usr/bin:/usr/sbin', 'chronyc', 'sources',
:param config: Configuration
"""
log.info('Checking initial clock skew...')
+ cluster = filter_out_containers(ctx.cluster)
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'PATH=/usr/bin:/usr/sbin', 'ntpq', '-p', run.Raw('||'),
'PATH=/usr/bin:/usr/sbin', 'chronyc', 'sources',
finally:
log.info('Checking final clock skew...')
+ cluster = filter_out_containers(ctx.cluster)
run.wait(
- ctx.cluster.run(
+ cluster.run(
args=[
'PATH=/usr/bin:/usr/sbin', 'ntpq', '-p', run.Raw('||'),
'PATH=/usr/bin:/usr/sbin', 'chronyc', 'sources',