Adjust k8s symlink remove hook to run only in controllers
This commit limits the scope of the hook to the controllers, which is the type of host where the symlink is expected to exist. Without this commit, rollback fails in other types of host. Test Plan PASS: run host-rollback in controllers PASS: run host-rollback in other types of host Story: 2010676 Task: 50896 Change-Id: I96b9415a53118c81990bb7c1c3a28ee4d2d38e50 Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
This commit is contained in:
@@ -188,12 +188,15 @@ class RemoveKubernetesConfigSymlinkHook(BaseHook):
|
||||
K8S_ENCRYPTION_PROVIDER_FILE = "/etc/kubernetes/encryption-provider.yaml"
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
os.unlink(self.K8S_ENCRYPTION_PROVIDER_FILE)
|
||||
LOG.info("%s symlink removed" % self.K8S_ENCRYPTION_PROVIDER_FILE)
|
||||
except Exception as e:
|
||||
LOG.exception("Failed to remove symlink: %s" % str(e))
|
||||
raise
|
||||
nodetype = utils.get_platform_conf("nodetype")
|
||||
if nodetype == constants.CONTROLLER:
|
||||
try:
|
||||
if os.path.exists(self.K8S_ENCRYPTION_PROVIDER_FILE):
|
||||
os.unlink(self.K8S_ENCRYPTION_PROVIDER_FILE)
|
||||
LOG.info("%s symlink removed" % self.K8S_ENCRYPTION_PROVIDER_FILE)
|
||||
except Exception as e:
|
||||
LOG.exception("Failed to remove symlink: %s" % str(e))
|
||||
raise
|
||||
|
||||
|
||||
class RemoveCephMonHook(BaseHook):
|
||||
|
||||
Reference in New Issue
Block a user