Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: don't unset ICE_CONFIG (fix #191) #193

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 35 additions & 43 deletions src/omero/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,49 +1716,41 @@ def argv(args=sys.argv):
Finally, the cli enters a command loop reading from standard in.
"""

# Modiying the run-time environment
old_ice_config = os.getenv("ICE_CONFIG")
os.unsetenv("ICE_CONFIG")
try:

# Modifying the args list if the name of the file
# has arguments encoded in it
original_executable = path(args[0])
base_executable = str(original_executable.basename())
if base_executable.find("-") >= 0:
parts = base_executable.split("-")
for arg in args[1:]:
parts.append(arg)
args = parts

# Now load other plugins. After debugging is turned on, but before
# tracing.
cli = CLI(prog=original_executable.split("-")[0])

parser = Parser(add_help=False)
# parser.add_argument("-d", "--debug", help="Use 'help debug' for more
# information", default = SUPPRESS)
parser.add_argument(
"--path", action="append",
help="Add file or directory to plugin list. Supports globs.")
ns, args = parser.parse_known_args(args)
if getattr(ns, "path"):
for p in ns.path:
for g in glob.glob(p):
cli._plugin_paths.append(g)

# For argparse dispatch, this cannot be done lazily
cli.loadplugins()

if len(args) > 1:
cli.invoke(args[1:])
return cli.rv
else:
cli.invokeloop()
return cli.rv
finally:
if old_ice_config:
os.putenv("ICE_CONFIG", old_ice_config)
# Modifying the args list if the name of the file
# has arguments encoded in it
original_executable = path(args[0])
base_executable = str(original_executable.basename())
if base_executable.find("-") >= 0:
parts = base_executable.split("-")
for arg in args[1:]:
parts.append(arg)
args = parts

# Now load other plugins. After debugging is turned on, but before
# tracing.
cli = CLI(prog=original_executable.split("-")[0])

parser = Parser(add_help=False)
# parser.add_argument("-d", "--debug", help="Use 'help debug' for more
# information", default = SUPPRESS)
parser.add_argument(
"--path", action="append",
help="Add file or directory to plugin list. Supports globs.")
ns, args = parser.parse_known_args(args)
if getattr(ns, "path"):
for p in ns.path:
for g in glob.glob(p):
cli._plugin_paths.append(g)

# For argparse dispatch, this cannot be done lazily
cli.loadplugins()

if len(args) > 1:
cli.invoke(args[1:])
return cli.rv
else:
cli.invokeloop()
return cli.rv

#####################################################
#
Expand Down
1 change: 1 addition & 0 deletions src/omero/plugins/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,7 @@ def _check(msg, vers):
# See ticket #10051
popen = self.ctx.popen(["icegridnode", "--version"])
env = self.ctx._env()
# Unclear how this could have been set with the call to unsetenv
ice_config = env.get("ICE_CONFIG")
if ice_config is not None and not os.path.exists(ice_config):
popen = self.ctx.popen(["icegridnode", "--version"],
Expand Down