Skip to content

Commit be22517

Browse files
committed
testing with version 3 find
1 parent 55b341d commit be22517

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

spython/instance/cmd/iutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get(self, name, return_json=False, quiet=False):
5151

5252
# Ensure compatible for singularity prior to 3.0, and after 3.0
5353
subgroup = "instance.list"
54-
if get_singularity_version().startswith("3"):
54+
if get_singularity_version().find("version 3"):
5555
subgroup = ["instance", "list"]
5656

5757
cmd = self._init_command(subgroup)

spython/instance/cmd/start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def start(self, image=None, name=None, sudo=False, options=[], capture=False):
5656

5757
# Derive subgroup command based on singularity version
5858
subgroup = 'instance.start'
59-
if get_singularity_version().startswith("3"):
59+
if get_singularity_version().find("version 3"):
6060
subgroup = ["instance", "start"]
6161

6262
cmd = self._init_command(subgroup)

spython/instance/cmd/stop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def stop(self, name=None, sudo=False):
3838
check_install()
3939

4040
subgroup = 'instance.stop'
41-
if get_singularity_version().startswith("3"):
41+
if get_singularity_version().find("version 3"):
4242
subgroup = ["instance", "stop"]
4343

4444
cmd = self._init_command(subgroup)

spython/main/instances.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def instances(self, name=None, return_json=False, quiet=False):
4343
check_install()
4444

4545
subgroup = 'instance.list'
46-
if get_singularity_version().startswith("3"):
46+
if get_singularity_version().find("version 3"):
4747
subgroup = ["instance", "list"]
4848

4949
cmd = self._init_command(subgroup)

spython/utils/terminal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def get_singularity_version():
7070
return version
7171

7272
if version['return_code'] == 0:
73-
version = version['message'][0].strip('\n')
73+
if len(version['message']) > 0:
74+
version = version['message'][0].strip('\n')
7475

7576
return version
7677

0 commit comments

Comments
 (0)