Skip to content

Commit

Permalink
only split run command flags once
Browse files Browse the repository at this point in the history
I ran into an issue trying to set an env variable that contained an
equal sign. Probably safe to guard againt mounts and buckets containing
colons as well.
  • Loading branch information
drschwenk committed Jul 17, 2024
1 parent b6a9e57 commit 9ef0319
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gantry/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,31 +384,31 @@ def run(
env_vars = []
for e in env or []:
try:
env_name, val = e.split("=")
env_name, val = e.split("=", 1)
except ValueError:
raise ValueError("Invalid --env option: {e}")
env_vars.append((env_name, val))

env_secrets = []
for e in env_secret or []:
try:
env_secret_name, secret = e.split("=")
env_secret_name, secret = e.split("=", 1)
except ValueError:
raise ValueError(f"Invalid --env-secret option: '{e}'")
env_secrets.append((env_secret_name, secret))

mounts = []
for m in mount or []:
try:
source, target = m.split(":")
source, target = m.split(":", 1)
except ValueError:
raise ValueError(f"Invalid --mount option: '{m}'")
mounts.append((source, target))

weka_buckets = []
for m in weka or []:
try:
source, target = m.split(":")
source, target = m.split(":", 1)
except ValueError:
raise ValueError(f"Invalid --weka option: '{m}'")
weka_buckets.append((source, target))
Expand Down

0 comments on commit 9ef0319

Please sign in to comment.