Skip to content

Commit

Permalink
Closes-Bug: #1552490
Browse files Browse the repository at this point in the history
Add restart of ntp after updating ntp.conf file

Change-Id: I04f6de563aaf21c46a7de1cfd891c8f1a1a4d654
  • Loading branch information
Raj Reddy committed Apr 21, 2016
1 parent 21fcb5b commit 7c2ae93
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fabfile/tasks/ntp.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
from fabfile.config import *
from fabfile.utils.fabos import detect_ostype

@task
@roles('all')
def get_all_time():
date = sudo("DATE=$( date ); DATEMILLISEC=$( date +%s ); echo $DATE; echo $DATEMILLISEC")
return tuple(date.split('\r\n'))

def restart_ntp_node():
ostype = detect_ostype()
if ostype in ['ubuntu']:
sudo("service ntp restart", warn_only=True)
else:
sudo("service ntpd restart", warn_only=True)

@task
@roles('all')
def restart_ntp():
sudo("service ntp restart", warn_only=True)
execute('restart_ntp_node')

@task
@parallel
Expand Down

0 comments on commit 7c2ae93

Please sign in to comment.