Bläddra i källkod

Merge pull request #5098 from ashcrow/bin-sync-link-check

Merged by openshift-bot
OpenShift Bot 7 år sedan
förälder
incheckning
a61da58f73
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      roles/openshift_cli/library/openshift_container_binary_sync.py

+ 5 - 0
roles/openshift_cli/library/openshift_container_binary_sync.py

@@ -133,6 +133,11 @@ class BinarySyncer(object):
         dest_path = os.path.join(self.bin_dir, binary_name)
         incoming_checksum = self.module.run_command(['sha256sum', src_path])[1]
         if not os.path.exists(dest_path) or self.module.run_command(['sha256sum', dest_path])[1] != incoming_checksum:
+
+            # See: https://github.com/openshift/openshift-ansible/issues/4965
+            if os.path.islink(dest_path):
+                os.unlink(dest_path)
+                self.output.append('Removed old symlink {} before copying binary.'.format(dest_path))
             shutil.move(src_path, dest_path)
             self.output.append("Moved %s to %s." % (src_path, dest_path))
             self.changed = True