Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(args, parser, subparser):
if check_install() is not True:
bot.error("Cannot find Singularity! Is it installed?")
sys.exit(1)
def mkdir_p(path):
'''mkdir_p attempts to get the same functionality as mkdir -p
:param path: the path to create.
'''
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
bot.error("Error creating path %s, exiting." % path)
sys.exit(1)
def main(args, parser, subparser):
if check_install() is not True:
bot.error("Cannot find Singularity! Is it installed?")
sys.exit(1)
def main(args, parser, subparser):
if check_install() is not True:
bot.error("Cannot find Singularity! Is it installed?")
sys.exit(1)
if not return_json:
for i in instances:
new_instance = Instance(
pid=i["pid"],
name=i["daemon_name"],
image=i["container_image"],
start=False,
)
listing.append(new_instance)
instances = listing
# Couldn't get UID
elif output["return_code"] == 255:
bot.error("Couldn't get UID")
# Return code of 0
else:
bot.info("No instances found.")
# If we are given a name, return just one
if name is not None and len(instances) == 1:
instances = instances[0]
return instances
# Otherwise, add instances to the listing
new_instance = self.instance(
pid=i["pid"],
name=i["daemon_name"],
image=i["container_image"],
start=False,
)
listing.append(new_instance)
instances = listing
# Couldn't get UID
elif output["return_code"] == 255:
bot.error("Couldn't get UID")
# Return code of 0
else:
bot.info("No instances found.")
# If we are given a name, return just one
if name is not None and instances not in [None, []]:
if len(instances) == 1:
instances = instances[0]
return instances
if timeout:
subgroup += ["-t", str(timeout)]
cmd = self._init_command(subgroup, singularity_options)
# If name is provided assume referencing an instance
instance_name = self.name
if name is not None:
instance_name = name
cmd = cmd + [instance_name]
output = run_command(cmd, sudo=sudo, quiet=True)
if output["return_code"] != 0:
message = "%s : return code %s" % (output["message"], output["return_code"])
bot.error(message)
return output["return_code"]
return output["return_code"]