liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.5k stars 260 forks source link

Multiple contexts: only last one is synced #736

Open vict0rsch opened 4 years ago

vict0rsch commented 4 years ago

Do you read the FAQ?

Files are only uploaded to the second of my two contexts, with config:

[
    {
        "name": "beluga",
        "host": "beluga4.computecanada.ca",
        "protocol": "sftp",
        "port": 22,
        "username": "vsch",
        "remotePath": "/home/vsch/continual-translation",
        "uploadOnSave": true,
        "ignore": [
            ".vscode",
            ".git",
            ".DS_Store",
            "ct-env",
            "s2w_d"
        ]
    },
    {
        "name": "mila",
        "host": "login-1.server.mila.quebec",
        "protocol": "sftp",
        "port": 8001,
        "username": "schmidtv",
        "remotePath": "/network/home/schmidtv/continual-translation",
        "uploadOnSave": true,
        "ignore": [
            ".vscode",
            ".git",
            ".DS_Store",
            "ct-env",
            "s2w_d"
        ]
    }
]

Given this config I'd expect both remote dirs to be synced with my local one. However name1 is not updated if I add name2 (but it is if I remove it). Also, name1 is not listed when I hit SFTP: sync local -> remote from the command palette

2020-03-05 at 15 27

Extension Logs from Startup - required

[03-05 15:24:44] [debug] register command "Cancel All Transfer" from "./commandCancelAllTransfer.ts"
[03-05 15:24:44] [debug] register command "Config" from "./commandConfig.ts"
[03-05 15:24:44] [debug] register command "List Active Folder" from "./commandListActiveFolder.ts"
[03-05 15:24:44] [debug] register command "Open Ssh Connection" from "./commandOpenSshConnection.ts"
[03-05 15:24:44] [debug] register command "Set Profile" from "./commandSetProfile.ts"
[03-05 15:24:44] [debug] register command "Toggle Output Panel" from "./commandToggleOutputPanel.ts"
[03-05 15:24:44] [debug] register command "Upload Changed Files" from "./commandUploadChangedFiles.ts"
[03-05 15:24:44] [debug] register command "Delete Remote" from "./fileCommandDeleteRemote.ts"
[03-05 15:24:44] [debug] register command "Diff" from "./fileCommandDiff.ts"
[03-05 15:24:44] [debug] register command "Diff Active File" from "./fileCommandDiffActiveFile.ts"
[03-05 15:24:44] [debug] register command "Download" from "./fileCommandDownload.ts"
[03-05 15:24:44] [debug] register command "Download Active File" from "./fileCommandDownloadActiveFile.ts"
[03-05 15:24:44] [debug] register command "Download Active Folder" from "./fileCommandDownloadActiveFolder.ts"
[03-05 15:24:44] [debug] register command "Download File" from "./fileCommandDownloadFile.ts"
[03-05 15:24:44] [debug] register command "Download Folder" from "./fileCommandDownloadFolder.ts"
[03-05 15:24:44] [debug] register command "Download Force" from "./fileCommandDownloadForce.ts"
[03-05 15:24:44] [debug] register command "Download Project" from "./fileCommandDownloadProject.ts"
[03-05 15:24:44] [debug] register command "Edit In Local" from "./fileCommandEditInLocal.ts"
[03-05 15:24:44] [debug] register command "List" from "./fileCommandList.ts"
[03-05 15:24:44] [debug] register command "List All" from "./fileCommandListAll.ts"
[03-05 15:24:44] [debug] register command "Reveal In Explorer" from "./fileCommandRevealInExplorer.ts"
[03-05 15:24:44] [debug] register command "Reveal In Remote Explorer" from "./fileCommandRevealInRemoteExplorer.ts"
[03-05 15:24:44] [debug] register command "Sync Both Directions" from "./fileCommandSyncBothDirections.ts"
[03-05 15:24:44] [debug] register command "Sync Local To Remote" from "./fileCommandSyncLocalToRemote.ts"
[03-05 15:24:44] [debug] register command "Sync Remote To Local" from "./fileCommandSyncRemoteToLocal.ts"
[03-05 15:24:44] [debug] register command "Upload" from "./fileCommandUpload.ts"
[03-05 15:24:44] [debug] register command "Upload Active File" from "./fileCommandUploadActiveFile.ts"
[03-05 15:24:44] [debug] register command "Upload Active Folder" from "./fileCommandUploadActiveFolder.ts"
[03-05 15:24:44] [debug] register command "Upload File" from "./fileCommandUploadFile.ts"
[03-05 15:24:44] [debug] register command "Upload Folder" from "./fileCommandUploadFolder.ts"
[03-05 15:24:44] [debug] register command "Upload Force" from "./fileCommandUploadForce.ts"
[03-05 15:24:44] [debug] register command "Upload Project" from "./fileCommandUploadProject.ts"
[03-05 15:24:44] [info] config at /Users/victor/Documents/Github/vict0rsch/continual-translation {"remotePath":"/home/vsch/continual-translation","uploadOnSave":true,"downloadOnOpen":false,"ignore":[".vscode",".git",".DS_Store","ct-env","s2w_d"],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"name":"beluga","host":"beluga4.computecanada.ca","port":22,"username":"******"}
[03-05 15:24:44] [info] config at /Users/victor/Documents/Github/vict0rsch/continual-translation {"remotePath":"/network/home/schmidtv/continual-translation","uploadOnSave":true,"downloadOnOpen":false,"ignore":[".vscode",".git",".DS_Store","ct-env","s2w_d"],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"name":"mila","host":"login-1.server.mila.quebec","port":8001,"username":"******"}
[03-05 15:25:12] [info] [file-save] /Users/victor/Documents/Github/vict0rsch/continual-translation/tests/test.py
[03-05 15:25:12] [trace] handle upload file for /Users/victor/Documents/Github/vict0rsch/continual-translation/tests/test.py
[03-05 15:25:17] [debug] Local ident: 'SSH-2.0-ssh2js0.4.5'
[03-05 15:25:17] [debug] Client: Trying login-1.server.mila.quebec on port 8001 ...
[03-05 15:25:17] [debug] Client: Connected
[03-05 15:25:17] [debug] Remote ident: 'SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3'
[03-05 15:25:17] [debug] Outgoing: Writing KEXINIT
[03-05 15:25:17] [debug] DEBUG: Comparing KEXINITs ...
[03-05 15:25:17] [debug] (local) KEX algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
[03-05 15:25:17] [debug] (remote) KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
[03-05 15:25:17] [debug] KEX algorithm: ecdh-sha2-nistp256
[03-05 15:25:17] [debug] (local) Host key formats: ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
[03-05 15:25:17] [debug] (remote) Host key formats: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
[03-05 15:25:17] [debug] Host key format: ssh-ed25519
[03-05 15:25:17] [debug] (local) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com
[03-05 15:25:17] [debug] (remote) Client->Server ciphers: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
[03-05 15:25:17] [debug] Client->Server Cipher: aes128-ctr
[03-05 15:25:17] [debug] (local) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com
[03-05 15:25:17] [debug] (remote) Server->Client ciphers: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
[03-05 15:25:17] [debug] Server->Client Cipher: aes128-ctr
[03-05 15:25:17] [debug] (local) Client->Server HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
[03-05 15:25:17] [debug] (remote) Client->Server HMAC algorithms: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[03-05 15:25:17] [debug] Client->Server HMAC algorithm: hmac-sha2-256
[03-05 15:25:17] [debug] (local) Server->Client HMAC algorithms: hmac-sha2-256,hmac-sha2-512,hmac-sha1
[03-05 15:25:17] [debug] (remote) Server->Client HMAC algorithms: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[03-05 15:25:17] [debug] Server->Client HMAC algorithm: hmac-sha2-256
[03-05 15:25:17] [debug] (local) Client->Server compression algorithms: none,zlib@openssh.com,zlib
[03-05 15:25:17] [debug] (remote) Client->Server compression algorithms: none,zlib@openssh.com
[03-05 15:25:17] [debug] Client->Server compression algorithm: none
[03-05 15:25:17] [debug] (local) Server->Client compression algorithms: none,zlib@openssh.com,zlib
[03-05 15:25:17] [debug] (remote) Server->Client compression algorithms: none,zlib@openssh.com
[03-05 15:25:17] [debug] Server->Client compression algorithm: none
[03-05 15:25:17] [debug] Outgoing: Writing KEXECDH_INIT
[03-05 15:25:17] [debug] DEBUG: Checking host key format
[03-05 15:25:17] [debug] DEBUG: Checking signature format
[03-05 15:25:17] [debug] DEBUG: Verifying host fingerprint
[03-05 15:25:17] [debug] DEBUG: Host accepted by default (no verification)
[03-05 15:25:17] [debug] DEBUG: Verifying signature
[03-05 15:25:17] [debug] Outgoing: Writing NEWKEYS
[03-05 15:25:17] [debug] Outgoing: Writing SERVICE_REQUEST (ssh-userauth)
[03-05 15:25:17] [debug] Outgoing: Writing USERAUTH_REQUEST (none)
[03-05 15:25:17] [debug] Client: none auth failed
[03-05 15:25:17] [debug] Outgoing: Writing USERAUTH_REQUEST (password)
[03-05 15:25:17] [debug] Outgoing: Writing CHANNEL_OPEN (0, session)
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_REQUEST (0, subsystem: sftp)
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing MKDIR
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing LSTAT
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing OPEN
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing FSTAT
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing FSETSTAT
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing WRITE
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing FSETSTAT
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [debug] Outgoing: Writing CLOSE
[03-05 15:25:18] [debug] Outgoing: Writing CHANNEL_DATA (0)
[03-05 15:25:18] [info] local ➞ remote /Users/victor/Documents/Github/vict0rsch/continual-translation/tests/test.py
jos-webservices commented 4 years ago

No text.

f4bio commented 4 years ago

you are missing the context field in your config

something like:

[
    {
        "name": "beluga",
        "host": "beluga4.computecanada.ca",
        "context": "prod",
        "protocol": "sftp",
        ....
    },
    {
        "name": "mila",
        "host": "login-1.server.mila.quebec",
        "context": "dev",
        "protocol": "sftp",
        ....
    }
]

should work.

vict0rsch commented 4 years ago

If I understand correctly context is a path ; therefore if I want the same directory synced similarly on 2 remote servers, "context": "." is the way to go, right?

jos-webservices commented 4 years ago

I noticed, I was using the config the wrong way. Now, I separated all my workspaces and gave them separate configs - all fine for me...

f4bio commented 4 years ago

aah... i'm so sorry, i was totally focused on the second part of your question:

Also, name1 is not listed when I hit SFTP: sync local -> remote from the command palette

this can be fixed by setting different contexts (or conticest? :P), like this:

[
  {
    "name": "my project @ server1",
    "host": "server1.net",
    "context": "dev",
    "protocol": "sftp",
    "port": 22,
    "username": "ubuntu",
    "remotePath": "/home/ubuntu/my-project",
    "uploadOnSave": false,
    "privateKeyPath": "/Users/f4bio/.ssh/id_ed25519",
    "ignore": [
      ".vscode", 
      ".git", 
      ".DS_Store"
    ]
  },
  {
    "name": "my project @ server2",
    "host": "server2.de",
    "context": "prod",
    "protocol": "sftp",
    "port": 22,
    "username": "admin",
    "remotePath": "/home/admin/my-project",
    "uploadOnSave": false,
    "privateKeyPath": "/Users/f4bio/.ssh/id_ed25519",
    "ignore": [
      ".vscode", 
      ".git", 
      ".DS_Store"
    ]
  }
]

which results in: image

but you are right, with "uploadOnSave" set to true, saved files only get uploaded to the 2nd (or probably the last in this list?) profile. I'm going to take a look at the source-code later, fingers crossed I find something ;)

MarekLew commented 4 years ago

It's problem because this not work where you use two or more remote serwer and one context.

This is pointless when every time I change the target server I have to edit the configuration file because the list shows only one target because they have identical context

as1414 commented 1 year ago

@f4bio / @MarekLew is this still an issue? Was it ever resolved?

I'm trying to setup a multi-context setup right now. I have each configuration working independently if I remove the other one. But, when I have them both setup, I can not seem to get a file to upload to both or have any way to upload to the one that is not setup to "auto-update".

I have "production" and "dev" as my configuration entries. Dev is setup to uploadOnSave, but I'd like to manually push to production. I can't seem to find any way to upload to production.