]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
updated redhat ntp server in ntp.conf
authorsunilkumarn417 <sunnagar@redhat.com>
Wed, 5 Aug 2020 08:44:37 +0000 (14:14 +0530)
committersunilkumarn417 <sunnagar@redhat.com>
Thu, 24 Sep 2020 05:19:04 +0000 (10:49 +0530)
Signed-off-by: sunilkumarn417 <sunnagar@redhat.com>
teuthology/provision/cloud/openstack.py
teuthology/task/clock.py

index 67df8487f85769996bad42e37acb9de8e43b7b90..fadc940a4f0e3e406fe9c8c04c074c1f35c5c9f6 100644 (file)
@@ -114,8 +114,7 @@ class OpenStackProvider(Provider):
         if not hasattr(self, '_networks'):
             allow_networks = self.conf.get('allow_networks', '.*')
             if not isinstance(allow_networks, list):
-                allow_networks = [allow_networks]
-
+                allow_networks=[allow_networks]
             networks_re = [re.compile(x) for x in allow_networks]
             try:
                 networks = retry(self.driver.ex_list_networks)
@@ -334,10 +333,8 @@ class OpenStackProvisioner(base.Provisioner):
                 break
         if not matches:
             raise RuntimeError(
-                "Could not find an image for %s %s",
-                self.os_type,
-                self.os_version,
-            )
+                "Could not find an image for %s %s" %
+                (self.os_type, self.os_version))
         return matches[0]
 
     @property
@@ -476,6 +473,45 @@ class RHOpenStackProvisioner(OpenStackProvisioner):
         )
         self._read_conf(conf)
 
+    @property
+    def userdata(self):
+        spec="{t}-{v}".format(t=self.os_type,
+                              v=self.os_version)
+        base_config = dict(
+            packages=[
+                'git',
+                'wget',
+                'python',
+                'ntp',
+            ],
+        )
+        runcmd=[
+            # Remove the user's password so that console logins are
+            # possible
+            # sudo systemctl restart NetworkManager.service
+            ['passwd', '-d', self.user],
+            ['touch', self._sentinel_path],
+            ['sudo', 'systemctl', 'restart', 'NetworkManager.service']
+        ]
+        if spec in self.provider.default_userdata:
+            base_config = deepcopy(
+                    self.provider.default_userdata.get(spec, dict()))
+        base_config.update(user=self.user)
+        if 'manage_etc_hosts' not in base_config:
+            base_config.update(
+                manage_etc_hosts=True,
+                hostname=self.hostname,
+            )
+        base_config['runcmd'] = base_config.get('runcmd', list())
+        base_config['runcmd'].extend(runcmd)
+        ssh_pubkey = util.get_user_ssh_pubkey()
+        if ssh_pubkey:
+            authorized_keys = base_config.get('ssh_authorized_keys', list())
+            authorized_keys.append(ssh_pubkey)
+            base_config['ssh_authorized_keys'] = authorized_keys
+        user_str = "#cloud-config\n" + yaml.safe_dump(base_config)
+        return user_str
+
     def _create(self):
         userdata = self.userdata
         log.debug("Creating node: %s", self)
index 022eeaf7173b091f58cf863dda5d099ae56bd873..4d04b8ed0fd2d18a16e0bfa24afc3692b3472244 100644 (file)
@@ -31,6 +31,10 @@ def task(ctx, config):
 
     log.info('Syncing clocks and checking initial clock skew...')
     for rem in ctx.cluster.remotes.keys():
+        if rem.is_vm and ctx.config.get('redhat'):
+            rem.sh("sudo sed -i '/server*/d' /etc/ntp.conf")
+            rem.sh("echo 'server clock.corp.redhat.com iburst' | sudo tee -a /etc/ntp.conf",
+                   check_status=False)
         rem.run(
             args = [
                 'sudo', 'systemctl', 'stop', 'ntp.service', run.Raw('||'),