Skip to content

Commit b72db5e

Browse files
committed
updating mimetype
Signed-off-by: Vanessa Sochat <[email protected]>
1 parent 85853e4 commit b72db5e

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

singularity/build/google/instances.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,18 @@ def get_build_metadata(key):
235235

236236

237237
def get_build_params(metadata):
238-
'''get_build_params uses get_build_metadata to retrieve corresponding meta data values for a build
239-
:param metadata: a list, each item a dictionary of metadata, in format:
240-
metadata = [{'key': 'repo_url', 'value': repo_url },
241-
{'key': 'repo_id', 'value': repo_id },
242-
{'key': 'credential', 'value': credential },
243-
{'key': 'response_url', 'value': response_url },
244-
{'key': 'token', 'value': token},
245-
{'key': 'commit', 'value': commit }]
238+
'''get_build_params uses get_build_metadata to retrieve corresponding
239+
meta data values for a build
246240
241+
Parameters
242+
==========
243+
metadata: a list, each item a dictionary of metadata, in format:
244+
metadata = [{'key': 'repo_url', 'value': repo_url },
245+
{'key': 'repo_id', 'value': repo_id },
246+
{'key': 'credential', 'value': credential },
247+
{'key': 'response_url', 'value': response_url },
248+
{'key': 'token', 'value': token},
249+
{'key': 'commit', 'value': commit }]
247250
'''
248251
params = dict()
249252
for item in metadata:

singularity/build/google/storage.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,23 @@ def delete_object(storage_service, bucket_name, object_name):
6161
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
6262
def upload_file(storage_service,bucket,bucket_path,file_name,verbose=True):
6363
'''get_folder will return the folder with folder_name, and if create=True,
64-
will create it if not found. If folder is found or created, the metadata is
65-
returned, otherwise None is returned
66-
:param storage_service: the drive_service created from get_storage_service
67-
:param bucket: the bucket object from get_bucket
68-
:param file_name: the name of the file to upload
69-
:param bucket_path: the path to upload to
64+
will create it if not found. If folder is found or created, the metadata is
65+
returned, otherwise None is returned
66+
67+
Parameters
68+
==========
69+
storage_service: the drive_service created from get_storage_service
70+
bucket: the bucket object from get_bucket
71+
file_name: the name of the file to upload
72+
bucket_path: the path to upload to
7073
'''
7174
# Set up path on bucket
7275
upload_path = "%s/%s" %(bucket['id'],bucket_path)
7376
if upload_path[-1] != '/':
7477
upload_path = "%s/" %(upload_path)
7578
upload_path = "%s%s" %(upload_path,os.path.basename(file_name))
76-
body = {'name': upload_path }
79+
body = {'name': upload_path}
80+
7781
# Create media object with correct mimetype
7882
if os.path.exists(file_name):
7983
mimetype = sniff_extension(file_name,verbose=verbose)

singularity/build/google/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
################################################################################
3030

3131
def get_google_service(service_type=None, version=None):
32-
'''
33-
get a google service using the discovery client.
34-
:param service_type: the service to get (default is storage)
35-
:param version: version to use (default is v1)
32+
'''get a google service using the discovery client.
33+
34+
Parameters
35+
==========
36+
service_type: the service to get (default is storage)
37+
version: version to use (default is v1)
3638
'''
3739
if service_type == None:
3840
service_type = "storage"

singularity/build/scripts/singularity-prepare-instance.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ sudo apt-get -y install git \
3737
python3-pip
3838

3939
# Pip3 installs
40-
sudo -H pip3 install --upgrade pip
41-
sudo -H pip3 install pyasn1-modules -U
42-
sudo -H pip3 install --upgrade google-api-python-client
43-
sudo -H pip3 install --upgrade google
44-
sudo -H pip3 install oauth2client==3.0.0
40+
sudo -H python3 -m pip install --upgrade pip
41+
sudo -H python3 -m pip install pyasn1-modules -U
42+
sudo -H python3 -m pip install --upgrade google-api-python-client
43+
sudo -H python3 -m pip install --upgrade google
44+
sudo -H python3 -m pip install oauth2client==3.0.0
4545

4646
# Install GoLang
4747
export VERSION=1.12.6 OS=linux ARCH=amd64

singularity/build/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def sniff_extension(file_path,verbose=True):
182182
"mp3": 'audio/mpeg',
183183
"zip": 'application/zip',
184184
"simg": 'application/zip',
185+
"sif": 'application/zip',
185186
"rar": 'application/rar',
186187
"tar": 'application/tar',
187188
"arj": 'application/arj',

0 commit comments

Comments
 (0)