changed the temp file creation for common source
* Instead of same package name, it will create
random string, so that if multiple version of
same pkg uses same source at the same time,
conflict will not occur
Change-Id: I0149501c71a63225288e337b73204f21bb1e9e79
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6401
Tested-by: michellew <michellew@vmware.com>
Reviewed-by: michellew <michellew@vmware.com>
| ... | ... |
@@ -13,6 +13,8 @@ import os |
| 13 | 13 |
import hashlib |
| 14 | 14 |
import datetime |
| 15 | 15 |
import requests |
| 16 |
+import random |
|
| 17 |
+import string |
|
| 16 | 18 |
from requests.auth import HTTPBasicAuth |
| 17 | 19 |
from CommandUtils import CommandUtils |
| 18 | 20 |
|
| ... | ... |
@@ -76,7 +78,9 @@ class pullSources: |
| 76 | 76 |
# download to a temporary location (on the same filesystem) |
| 77 | 77 |
# and then rename it to the final destination filename. |
| 78 | 78 |
|
| 79 |
- temp_file_path = file_path + "-" + package |
|
| 79 |
+ temp_file_path = file_path + "-" + \ |
|
| 80 |
+ "".join([random.choice( |
|
| 81 |
+ string.ascii_letters + string.digits) for _ in range(6)]) |
|
| 80 | 82 |
|
| 81 | 83 |
with open(temp_file_path, 'wb') as handle: |
| 82 | 84 |
response = requests.get(url, auth=self._auth, stream=True) |