MCPcopy Create free account
hub / github.com/StackStorm/st2 / put

Method put

st2common/st2common/runners/parallel_ssh.py:156–186  ·  view source on GitHub ↗

Copy a file or folder to remote host. :param local_path: Path to local file or dir. Must be shlex quoted. :type local_path: ``str`` :param remote_path: Path to remote file or dir. Must be shlex quoted. :type remote_path: ``str`` :param mode: Option

(self, local_path, remote_path, mode=None, mirror_local_mode=False)

Source from the content-addressed store, hash-verified

154 return results
155
156 def put(self, local_path, remote_path, mode=None, mirror_local_mode=False):
157 """
158 Copy a file or folder to remote host.
159
160 :param local_path: Path to local file or dir. Must be shlex quoted.
161 :type local_path: ``str``
162
163 :param remote_path: Path to remote file or dir. Must be shlex quoted.
164 :type remote_path: ``str``
165
166 :param mode: Optional mode to use for the file or dir.
167 :type mode: ``int``
168
169 :param mirror_local_mode: Optional Flag to mirror the mode
170 on local file/dir on remote host.
171 :type mirror_local_mode: ``boolean``
172
173 :rtype: ``dict`` of ``str`` to ``dict``
174 """
175
176 if not os.path.exists(local_path):
177 raise Exception("Local path %s does not exist." % local_path)
178
179 options = {
180 "local_path": local_path,
181 "remote_path": remote_path,
182 "mode": mode,
183 "mirror_local_mode": mirror_local_mode,
184 }
185
186 return self._execute_in_pool(self._put_files, **options)
187
188 def mkdir(self, path):
189 """

Callers 3

test_putMethod · 0.95
mainFunction · 0.95
_put_filesMethod · 0.45

Calls 2

_execute_in_poolMethod · 0.95
existsMethod · 0.80

Tested by 2

test_putMethod · 0.76
mainFunction · 0.76