Skip to content

Commit 55b9057

Browse files
committed
modified: singularity/cli/__init__.py
1 parent aad4c8b commit 55b9057

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

singularity/cli/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ def pull(self,image_path,pull_folder='',
282282
name_by_hash=False
283283
name_by_commit=False
284284

285+
final_image = None
286+
285287
if not image_path.startswith('shub://') and not image_path.startswith('docker://'):
286288
bot.error("pull is only valid for docker and shub, %s is invalid." %image_name)
287289
sys.exit(1)
@@ -293,6 +295,7 @@ def pull(self,image_path,pull_folder='',
293295

294296
if pull_folder not in [None,'']:
295297
os.environ['SINGULARITY_PULLFOLDER'] = pull_folder
298+
pull_folder = "%s/" % pull_folder
296299

297300
if image_path.startswith('shub://'):
298301
if image_name is not None:
@@ -304,21 +307,23 @@ def pull(self,image_path,pull_folder='',
304307
elif name_by_hash is True:
305308
bot.debug("user specified naming by hash.")
306309
cmd.append("--hash")
307-
else: # otherwise let the Singularity client determine own name
308-
image_name = "%s" %image_path.replace("shub://","").replace("/","-")
309-
310+
# otherwise let the Singularity client determine own name
311+
310312
elif image_path.startswith('docker://'):
311313
if size is not None:
312314
cmd = cmd + ["--size",size]
313315
if image_name is None:
314316
image_name = "%s" %image_path.replace("docker://","").replace("/","-")
317+
final_image = "%s%s.img" %(pull_folder,image_name)
315318
cmd = cmd + ["--name", image_name]
316319

317320
cmd.append(image_path)
318321
bot.debug(' '.join(cmd))
319322
output = self.run_command(cmd)
320323
self.println(output)
321-
return output.split('Container is at:')[-1].strip('\n').strip()
324+
if final_image is None: # shub
325+
final_image = output.split('Container is at:')[-1].strip('\n').strip()
326+
return final_image
322327

323328

324329
def run(self,image_path,args=None,writable=False,contain=False):

0 commit comments

Comments
 (0)