sshkube 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sshkube-0.2.0 → sshkube-0.2.1}/PKG-INFO +1 -1
- {sshkube-0.2.0 → sshkube-0.2.1}/pyproject.toml +1 -1
- {sshkube-0.2.0 → sshkube-0.2.1}/sshkube/__main__.py +11 -2
- {sshkube-0.2.0 → sshkube-0.2.1}/LICENSE +0 -0
- {sshkube-0.2.0 → sshkube-0.2.1}/README.md +0 -0
- {sshkube-0.2.0 → sshkube-0.2.1}/sshkube/__init__.py +0 -0
- {sshkube-0.2.0 → sshkube-0.2.1}/sshkube/socat.py +0 -0
|
@@ -25,6 +25,14 @@ dotenv.load_dotenv()
|
|
|
25
25
|
workdir = pathlib.Path(os.environ.get('SSHKUBE_CONFIG', '~/.sshkube/')).expanduser()
|
|
26
26
|
dotenv.load_dotenv(workdir/'.env')
|
|
27
27
|
|
|
28
|
+
def Popen(*args, **kwargs):
|
|
29
|
+
''' Fixup some platform-specific oddities
|
|
30
|
+
'''
|
|
31
|
+
if sys.platform == 'win32':
|
|
32
|
+
if kwargs.get('start_new_session'):
|
|
33
|
+
kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
|
|
34
|
+
return subprocess.Popen(*args, **kwargs)
|
|
35
|
+
|
|
28
36
|
@click.group()
|
|
29
37
|
@click.version_option()
|
|
30
38
|
def cli(): pass
|
|
@@ -124,7 +132,7 @@ def _install(*, server, user, use_env, identity_file, verify, verbose):
|
|
|
124
132
|
|
|
125
133
|
# verify connection
|
|
126
134
|
try:
|
|
127
|
-
subprocess.check_call(make_ssh_cmd(server=server, flags=['-v'] if verbose else [], cmd=['echo', 'Success!']), stdout=sys.stdout, stderr=sys.stderr)
|
|
135
|
+
subprocess.check_call(make_ssh_cmd(server=server, flags=['-v'] if verbose else [], cmd=['echo', 'Success!']), stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr)
|
|
128
136
|
except subprocess.CalledProcessError as e:
|
|
129
137
|
raise click.UsageError('Failed to connect, check all options and any above errors') from e
|
|
130
138
|
|
|
@@ -171,7 +179,7 @@ def _start_server(*, server, force):
|
|
|
171
179
|
k8s_server = kubeconfig_['clusters'][0]['cluster']['server']
|
|
172
180
|
k8s_server_parsed = urlparse(k8s_server)
|
|
173
181
|
port = get_free_port()
|
|
174
|
-
proc =
|
|
182
|
+
proc = Popen(make_ssh_cmd(server=server, flags=[f"-NL{port}:{k8s_server_parsed.netloc}"]), start_new_session=True)
|
|
175
183
|
try:
|
|
176
184
|
wait_for_port(port)
|
|
177
185
|
PidFile(pid=proc.pid, port=port).write()
|
|
@@ -193,6 +201,7 @@ def _kill_server():
|
|
|
193
201
|
pid = PidFile.read()
|
|
194
202
|
if pid: pid.kill()
|
|
195
203
|
(workdir/'kube.config').unlink(missing_ok=True)
|
|
204
|
+
(workdir/'proxy.kube.config').unlink(missing_ok=True)
|
|
196
205
|
|
|
197
206
|
@cli.command()
|
|
198
207
|
@click.option('-s', '--server', envvar='SSHKUBE_SERVER', type=str, required=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|