Skip to content

Commit 86311fd

Browse files
authored
fix: observer command (#123)
* fix(observer): resolve -c flag conflict and crash - Remove -c short flag from --cookie option on ps:observer to fix conflict with -c for --ssh_cmd (Click silently took the last -c definition, making --cookie unreachable) - Add missing `auth` import in observer.py that caused a NameError crash on 401 responses - Fix sanitize_respone to handle multi-line Erlang/OTP warnings by extracting only the last non-empty line before stripping quotes * chore: bump version
1 parent 110e270 commit 86311fd

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

gigalixir/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ def google_signup(ctx):
10941094

10951095
@cli.command(name='ps:observer')
10961096
@click.option('-a', '--app_name', envvar="GIGALIXIR_APP")
1097-
@click.option('-c', '--cookie')
1097+
@click.option('--cookie')
10981098
@click.option('-o', '--ssh_opts', default="", help='Command-line options to pass to ssh.')
10991099
@click.option('-c', '--ssh_cmd', default="ssh", help='Which ssh command to use.')
11001100
@click.pass_context

gigalixir/observer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import subprocess
1010
import time
1111
from .shell import cast, call
12+
from . import auth
1213
from . import app as gigalixir_app
1314
from six.moves.urllib.parse import quote
1415

@@ -141,6 +142,11 @@ def ensure_port_free(port):
141142
pass
142143

143144
def sanitize_respone(text):
145+
# The output may contain multi-line warnings (e.g. Erlang/OTP version
146+
# notices). The actual value is always the last non-empty line.
147+
lines = [line for line in text.strip().splitlines() if line.strip()]
148+
if lines:
149+
text = lines[-1].strip()
144150
match = re.match(r"^(~c\"|')(.+)[\"']$", text)
145151
if match:
146152
return match.groups()[1]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
url='https://github.com/gigalixir/gigalixir-cli',
66
author='Tim Knight',
77
author_email='tim@gigalixir.com',
8-
version='1.16.0',
8+
version='1.16.1',
99
packages=find_packages(),
1010
include_package_data=True,
1111
install_requires=[

0 commit comments

Comments
 (0)