Use ntp parameter from network_settings 89/23389/2
authorFeng Pan <fpan@redhat.com>
Wed, 19 Oct 2016 21:31:30 +0000 (17:31 -0400)
committerFeng Pan <fpan@redhat.com>
Wed, 19 Oct 2016 23:01:33 +0000 (19:01 -0400)
Right now we use a ntp_server parameter set in deploy.sh, but since
new network_settings file contains ntp information already, we can
use those values instead.

JIRA: APEX-266

Change-Id: I717af80b967971ea9111002d657972efd94a163a
Signed-off-by: Feng Pan <fpan@redhat.com>
ci/deploy.sh
lib/python/apex/common/constants.py
lib/python/apex/network_settings.py

index 9affa80..6d3ded0 100755 (executable)
@@ -24,7 +24,6 @@ green=$(tput setaf 2 || echo "")
 
 interactive="FALSE"
 ping_site="8.8.8.8"
-ntp_server="pool.ntp.org"
 post_config="TRUE"
 debug="FALSE"
 
index db0a9fd..741bb4f 100644 (file)
@@ -18,6 +18,7 @@ COMPUTE = 'compute'
 OPNFV_NETWORK_TYPES = [ADMIN_NETWORK, TENANT_NETWORK, EXTERNAL_NETWORK,
                        STORAGE_NETWORK, API_NETWORK]
 DNS_SERVERS = ["8.8.8.8", "8.8.4.4"]
+NTP_SERVER = ["pool.ntp.org"]
 COMPUTE = 'compute'
 CONTROLLER = 'controller'
 ROLES = [COMPUTE, CONTROLLER]
index ca40ba9..c9f7d45 100644 (file)
@@ -21,6 +21,7 @@ from .common.constants import (
     ROLES,
     DOMAIN_NAME,
     DNS_SERVERS,
+    NTP_SERVER,
     ADMIN_NETWORK,
     EXTERNAL_NETWORK,
     OPNFV_NETWORK_TYPES,
@@ -113,6 +114,7 @@ class NetworkSettings(dict):
         if 'dns-domain' not in self:
             self['domain_name'] = DOMAIN_NAME
         self['dns_servers'] = self.get('dns_nameservers', DNS_SERVERS)
+        self['ntp_servers'] = self.get('ntp', NTP_SERVER)
 
     def _validate_overcloud_nic_order(self, network):
         """
@@ -333,6 +335,7 @@ class NetworkSettings(dict):
         bash_str += flatten('ip_addr_family', self.get_ip_addr_family())
         bash_str += flatten('dns_servers', self['dns_servers'], ' ')
         bash_str += flatten('domain_name', self['dns-domain'], ' ')
+        bash_str += flatten('ntp_server', self['ntp_servers'][0], ' ')
         if path:
             with open(path, 'w') as file:
                 file.write(bash_str)