MCPcopy
hub / github.com/hyperknot/openfreemap / put

Function put

ssh_lib/utils.py:13–34  ·  view source on GitHub ↗
(
    c, local_path, remote_path, permissions=None, user='root', group=None, create_parent_dir=False
)

Source from the content-addressed store, hash-verified

11
12
13def put(
14 c, local_path, remote_path, permissions=None, user='root', group=None, create_parent_dir=False
15):
16 tmp_path = f'/tmp/fabtmp_{random_string(8)}'
17 c.put(local_path, tmp_path)
18
19 if create_parent_dir:
20 dirname = os.path.dirname(remote_path)
21 c.sudo(f'mkdir -p {dirname}')
22 set_permission(c, dirname, user=user, group=group)
23
24 if is_dir(c, remote_path):
25 if not remote_path.endswith('/'):
26 remote_path += '/'
27
28 filename = os.path.basename(local_path)
29 remote_path += filename
30
31 c.sudo(f"mv '{tmp_path}' '{remote_path}'")
32 c.sudo(f"rm -rf '{tmp_path}'")
33
34 set_permission(c, remote_path, permissions=permissions, user=user, group=group)
35
36
37def put_dir(

Callers 9

init_autoupdateFunction · 0.90
upload_config_and_certsFunction · 0.90
kernel_thp_fixFunction · 0.90
wrkFunction · 0.90
prepare_venvFunction · 0.90
nginxFunction · 0.90
prepare_tile_genFunction · 0.90
put_dirFunction · 0.85
put_strFunction · 0.85

Calls 3

random_stringFunction · 0.85
set_permissionFunction · 0.85
is_dirFunction · 0.85

Tested by

no test coverage detected