Skip to content

Commit 82ee186

Browse files
fixup! Add kubernetes connector.
1 parent 61893cb commit 82ee186

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pyinfra/api/connectors/kubernetes.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
import click
66
import six
77

8-
from pyinfra import local, logger
8+
from pyinfra import logger
99
from pyinfra.api import QuoteString, StringCommand
10-
from pyinfra.api.exceptions import ConnectError, InventoryError, PyinfraError
10+
from pyinfra.api.exceptions import InventoryError
1111
from pyinfra.api.util import get_file_io, memoize
12-
from pyinfra.progress import progress_spinner
1312

1413
from .local import run_shell_command as run_local_shell_command
1514
from .util import make_unix_command
1615

16+
1717
@memoize
1818
def show_warning():
1919
logger.warning('The @kubernetes connector is in beta!')
2020

21+
2122
def make_names_data(pod=None):
2223
if not pod:
2324
raise InventoryError('No pod provided!')
@@ -32,12 +33,15 @@ def make_names_data(pod=None):
3233
yield '@kubernetes/{0}/{1}'.format(namespace, pod), \
3334
{'namespace': namespace, 'pod': pod}, ['@kubernetes']
3435

36+
3537
def connect(state, host, for_fact=None):
3638
return True
3739

40+
3841
def disconnect(state, host):
3942
return True
4043

44+
4145
def run_shell_command(
4246
state, host, command,
4347
get_pty=False,
@@ -82,6 +86,7 @@ def run_shell_command(
8286
return_combined_output=return_combined_output,
8387
)
8488

89+
8590
def put_file(
8691
state, host, filename_or_io, remote_filename,
8792
print_output=False, print_input=False,
@@ -112,7 +117,7 @@ def put_file(
112117
container = []
113118

114119
kubectl_command = StringCommand(
115-
'kubectl', 'cp',
120+
'kubectl', 'cp',
116121
temp_filename,
117122
'{0}/{1}:{2}'.format(host.host_data['namespace'],
118123
host.host_data['pod'],
@@ -159,7 +164,7 @@ def get_file(
159164
container = []
160165

161166
kubectl_command = StringCommand(
162-
'kubectl', 'cp',
167+
'kubectl', 'cp',
163168
'{0}/{1}:{2}'.format(host.host_data['namespace'],
164169
host.host_data['pod'],
165170
remote_filename),

0 commit comments

Comments
 (0)