|
13 | 13 | import subprocess |
14 | 14 | import sys |
15 | 15 | import tarfile |
| 16 | +import shutil |
16 | 17 |
|
17 | 18 | try: |
18 | 19 | # python3 |
@@ -48,11 +49,12 @@ def move_bundles(source, dest): |
48 | 49 | for f in os.listdir(source): |
49 | 50 | dst = os.path.join(dest, f) |
50 | 51 | if os.path.exists(dst): |
51 | | - raise DeployException( |
52 | | - "Not deploying. The bundle includes '%s' which we have previously deployed." |
| 52 | + print ( |
| 53 | + "Skipping bundle. The bundle includes '%s' which we have previously deployed." |
53 | 54 | % f |
54 | 55 | ) |
55 | | - renames[os.path.join(source, f)] = dst |
| 56 | + else: |
| 57 | + renames[os.path.join(source, f)] = dst |
56 | 58 |
|
57 | 59 | for (src, dst) in renames.iteritems(): |
58 | 60 | print ("Move %s -> %s" % (src, dst)) |
@@ -107,9 +109,9 @@ def deploy(self, tarball, extract_path): |
107 | 109 | extracted_bundles = os.path.join(extracted_dir, 'bundles') |
108 | 110 | move_bundles(source=extracted_bundles, dest=self.bundles_path) |
109 | 111 |
|
110 | | - # replace the (hopefully now empty) extracted_bundles dir with a |
111 | | - # symlink to the common dir. |
112 | | - os.rmdir(extracted_bundles) |
| 112 | + # replace the extracted_bundles dir (which may not be empty if some |
| 113 | + # bundles were skipped) with a symlink to the common dir. |
| 114 | + shutil.rmtree(extracted_bundles) |
113 | 115 | create_relative_symlink( |
114 | 116 | target=self.bundles_path, |
115 | 117 | linkname=extracted_bundles, |
|
0 commit comments