mirror of
https://gitee.com/jack_whh/ssh-scp-ssh-pipelines.git
synced 2026-03-09 22:42:55 +08:00
strip quotes
This commit is contained in:
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
last_ssh: |-
|
last_ssh: |-
|
||||||
echo $LASTSSH &&
|
echo $LASTSSH &&
|
||||||
(mkdir test1/test || true)
|
(mkdir test1/test || true)
|
||||||
|| ls -la
|
ls -la
|
||||||
|
|
||||||
- name: scp ssh pipelines
|
- name: scp ssh pipelines
|
||||||
uses: cross-the-world/ssh-scp-ssh-pipelines@latest
|
uses: cross-the-world/ssh-scp-ssh-pipelines@latest
|
||||||
|
|||||||
15
app.py
15
app.py
@@ -34,6 +34,17 @@ def convert_to_seconds(s):
|
|||||||
return 30
|
return 30
|
||||||
|
|
||||||
|
|
||||||
|
strips = ["", "\"", "", "'", ""]
|
||||||
|
|
||||||
|
|
||||||
|
def strip_path(p):
|
||||||
|
if not p:
|
||||||
|
return None
|
||||||
|
for c in strips:
|
||||||
|
p = p.strip(c)
|
||||||
|
return p
|
||||||
|
|
||||||
|
|
||||||
def connect(callback=None):
|
def connect(callback=None):
|
||||||
with paramiko.SSHClient() as ssh:
|
with paramiko.SSHClient() as ssh:
|
||||||
p_key = paramiko.RSAKey.from_private_key(INPUT_KEY) if INPUT_KEY else None
|
p_key = paramiko.RSAKey.from_private_key(INPUT_KEY) if INPUT_KEY else None
|
||||||
@@ -84,8 +95,8 @@ def scp_process(ssh, input_scp):
|
|||||||
continue
|
continue
|
||||||
l2r = c.split("=>")
|
l2r = c.split("=>")
|
||||||
if len(l2r) == 2:
|
if len(l2r) == 2:
|
||||||
local = l2r[0].strip()
|
local = strip_path(l2r[0])
|
||||||
remote = l2r[1].strip()
|
remote = strip_path(l2r[1])
|
||||||
if local and remote:
|
if local and remote:
|
||||||
copy_list.append({"l": local, "r": remote})
|
copy_list.append({"l": local, "r": remote})
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user