55import click
66import six
77
8- from pyinfra import local , logger
8+ from pyinfra import logger
99from pyinfra .api import QuoteString , StringCommand
10- from pyinfra .api .exceptions import ConnectError , InventoryError , PyinfraError
10+ from pyinfra .api .exceptions import InventoryError
1111from pyinfra .api .util import get_file_io , memoize
12- from pyinfra .progress import progress_spinner
1312
1413from .local import run_shell_command as run_local_shell_command
1514from .util import make_unix_command
1615
16+
1717@memoize
1818def show_warning ():
1919 logger .warning ('The @kubernetes connector is in beta!' )
2020
21+
2122def 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+
3537def connect (state , host , for_fact = None ):
3638 return True
3739
40+
3841def disconnect (state , host ):
3942 return True
4043
44+
4145def 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+
8590def 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