vagrant-scp-sync 0.5.11 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/vagrant-scp-sync/action/scp_sync.rb +0 -1
- data/lib/vagrant-scp-sync/command/scp.rb +49 -53
- data/lib/vagrant-scp-sync/errors.rb +5 -0
- data/lib/vagrant-scp-sync/plugin.rb +5 -6
- data/lib/vagrant-scp-sync/version.rb +1 -1
- data/locales/en.yml +8 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c034d409b3c2956435b324465f32bb5e24fa49c540c1fb7679915e72a6c8d1f6
|
4
|
+
data.tar.gz: 732a442ca6213677714a1008f5a732e36fe22c244893de2f0d33ec183d849cc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 778c512ff8d043a5e4bded18c66b8f35cf3e4f8ad1ceb7d683d99be79d2347cab690a4ab915adae677e448ec6dab1df3531f320232e6b6079f3235a9d8af9bba
|
7
|
+
data.tar.gz: 72e59dc346a18050df0303c6c7ad98637425ad8c54da4914a13b3bb1e63f108ddc1462a1c7a2ddd809fc78bea790c28701b79704ba2dd06d61c65fde997159e4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.5.12](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.11...v0.5.12) (2024-11-20)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* full implentation ([3715346](https://github.com/STARTcloud/vagrant-scp-sync/commit/3715346080fe36ccc08fb401770ef59de13c82ab))
|
9
|
+
* linting ([39b82ae](https://github.com/STARTcloud/vagrant-scp-sync/commit/39b82ae671da035f7bbb3eec693b99f950acc1fc))
|
10
|
+
* linting ([aa71732](https://github.com/STARTcloud/vagrant-scp-sync/commit/aa717326be49ecd3452e9a793c9bba2146a4efc5))
|
11
|
+
* linting ([c6a932b](https://github.com/STARTcloud/vagrant-scp-sync/commit/c6a932b9d476d31ea4bc522bd9356f2a273ca9bd))
|
12
|
+
* linting ([390be27](https://github.com/STARTcloud/vagrant-scp-sync/commit/390be27b4f042ae22e035d2829f236f59cccbced))
|
13
|
+
* linting ([ce4ba83](https://github.com/STARTcloud/vagrant-scp-sync/commit/ce4ba83954f318062886492f4742950b0b726957))
|
14
|
+
* linting ([4befd93](https://github.com/STARTcloud/vagrant-scp-sync/commit/4befd9393ff86006291b293534bdefffac5e413b))
|
15
|
+
|
3
16
|
## [0.5.11](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.10...v0.5.11) (2024-11-20)
|
4
17
|
|
5
18
|
|
@@ -14,7 +14,6 @@ module VagrantPlugins
|
|
14
14
|
source_files = expand_path(opts[:map], machine)
|
15
15
|
has_trailing_slash_source = opts[:map].end_with?('/')
|
16
16
|
sync_source_files = append_wildcard(source_files, has_trailing_slash_source)
|
17
|
-
|
18
17
|
target_files = expand_path(opts[:to], machine)
|
19
18
|
|
20
19
|
opts[:owner] ||= ssh_info[:username]
|
@@ -1,52 +1,56 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
+
require 'vagrant/util/subprocess'
|
5
|
+
require 'vagrant/util/which'
|
4
6
|
|
5
7
|
module VagrantPlugins
|
6
8
|
module ScpSync
|
7
9
|
module Command
|
8
10
|
# This class defines SCPSync
|
9
|
-
class
|
11
|
+
class ScpSyncCommand < Vagrant.plugin('2', :command)
|
10
12
|
def self.synopsis
|
11
13
|
'Copies data into a box via SCP'
|
12
14
|
end
|
13
15
|
|
14
16
|
def execute
|
15
|
-
@
|
16
|
-
return if @file2.nil?
|
17
|
+
@source, @target = parse_args
|
17
18
|
|
18
19
|
with_target_vms(host) do |machine|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
raise Vagrant::Errors::SSHNotReady if machine.ssh_info.nil?
|
21
|
+
|
22
|
+
if @source.nil? && @target.nil?
|
23
|
+
folders = machine.config.vm.synced_folders
|
24
|
+
ssh_info = machine.ssh_info
|
25
|
+
scp_path = Vagrant::Util::Which.which('scp')
|
26
|
+
machine.ui.warn(I18n.t('vagrant.scp_ssh_password')) if ssh_info[:private_key_path].empty? && ssh_info[:password]
|
27
|
+
folders.each_value do |folder_opts|
|
28
|
+
next unless folder_opts[:type] == :scp
|
29
|
+
|
30
|
+
VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
|
31
|
+
end
|
26
32
|
else
|
27
|
-
|
28
|
-
|
33
|
+
ssh_info = machine.ssh_info
|
34
|
+
scp_path = Vagrant::Util::Which.which('scp')
|
35
|
+
direction = net_ssh_command(@source)
|
36
|
+
source = format_file_path(machine, @source)
|
37
|
+
target = format_file_path(machine, @target)
|
38
|
+
folder_opts = {
|
39
|
+
type: :scp,
|
40
|
+
map: source,
|
41
|
+
to: target,
|
42
|
+
owner: ssh_info[:username],
|
43
|
+
group: ssh_info[:username],
|
44
|
+
direction: direction,
|
45
|
+
scp__args: ['--delete'],
|
46
|
+
rsync__args: ['--delete'],
|
47
|
+
disabled: false,
|
48
|
+
guestpath: target,
|
49
|
+
hostpath: source
|
50
|
+
}
|
51
|
+
|
52
|
+
VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
|
29
53
|
end
|
30
|
-
|
31
|
-
proxy_command = if @ssh_info[:proxy_command]
|
32
|
-
"-o ProxyCommand='#{@ssh_info[:proxy_command]}'"
|
33
|
-
else
|
34
|
-
''
|
35
|
-
end
|
36
|
-
|
37
|
-
command = [
|
38
|
-
'scp',
|
39
|
-
'-r',
|
40
|
-
'-o StrictHostKeyChecking=no',
|
41
|
-
'-o UserKnownHostsFile=/dev/null',
|
42
|
-
"-o port=#{@ssh_info[:port]}",
|
43
|
-
'-o LogLevel=ERROR',
|
44
|
-
proxy_command,
|
45
|
-
@ssh_info[:private_key_path].map { |k| "-i '#{k}'" }.join(' '),
|
46
|
-
source,
|
47
|
-
target
|
48
|
-
].join(' ')
|
49
|
-
system(command)
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
@@ -62,14 +66,16 @@ module VagrantPlugins
|
|
62
66
|
o.separator ''
|
63
67
|
end
|
64
68
|
argv = parse_options(opts)
|
65
|
-
return argv if argv && argv.length == 2
|
69
|
+
return argv if argv && (argv.empty? || argv.length == 2)
|
66
70
|
|
67
|
-
@env.ui.info(opts.help, prefix: false)
|
71
|
+
@env.ui.info(opts.help, prefix: false)
|
68
72
|
[nil, nil]
|
69
73
|
end
|
70
74
|
|
75
|
+
require_relative '../action/scp_sync'
|
76
|
+
|
71
77
|
def host
|
72
|
-
host = [@
|
78
|
+
host = [@source, @target].map do |file_spec|
|
73
79
|
file_spec.match(/^([^:]*):/)[1]
|
74
80
|
rescue NoMethodError
|
75
81
|
nil
|
@@ -78,33 +84,23 @@ module VagrantPlugins
|
|
78
84
|
host
|
79
85
|
end
|
80
86
|
|
81
|
-
def net_ssh_command
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
def source_files
|
86
|
-
format_file_path(@file1)
|
87
|
+
def net_ssh_command(source)
|
88
|
+
source.include?(':') ? :download : :upload
|
87
89
|
end
|
88
90
|
|
89
|
-
def
|
90
|
-
|
91
|
-
|
92
|
-
else
|
93
|
-
Pathname.new(source_files).basename
|
94
|
-
end
|
91
|
+
def expand_path(path, machine)
|
92
|
+
expanded_path = File.expand_path(path, machine.env.root_path)
|
93
|
+
Vagrant::Util::Platform.fs_real_path(expanded_path).to_s
|
95
94
|
end
|
96
95
|
|
97
|
-
def format_file_path(filepath)
|
96
|
+
def format_file_path(machine, filepath)
|
97
|
+
ssh_info = machine.ssh_info
|
98
98
|
if filepath.include?(':')
|
99
|
-
filepath.split(':').last.gsub('~', "/home/#{
|
99
|
+
filepath.split(':').last.gsub('~', "/home/#{ssh_info[:username]}")
|
100
100
|
else
|
101
101
|
filepath
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
105
|
-
def target_location_specified?
|
106
|
-
!@file2.end_with?(':')
|
107
|
-
end
|
108
104
|
end
|
109
105
|
end
|
110
106
|
end
|
@@ -15,6 +15,11 @@ module VagrantPlugins
|
|
15
15
|
error_key(:scp_sync_error, 'vagrant_scp_sync.errors')
|
16
16
|
end
|
17
17
|
|
18
|
+
# This Class denotes Errors for Manual SCP Sync
|
19
|
+
class SyncedFolderScpSyncScpSyncFolderError < VagrantScpSyncError
|
20
|
+
error_key(:scp_sync_folder_error, 'vagrant_scp_sync.errors')
|
21
|
+
end
|
22
|
+
|
18
23
|
# This Class denotes Delete Dir Errors for SCP Sync
|
19
24
|
class SyncedFolderScpSyncDeleteDirError < VagrantScpSyncError
|
20
25
|
error_key(:scp_sync_error_delete_directory, 'vagrant_scp_sync.errors')
|
@@ -17,12 +17,6 @@ module VagrantPlugins
|
|
17
17
|
Copy files to vagrant boxes via scp
|
18
18
|
DESC
|
19
19
|
|
20
|
-
command 'scp' do
|
21
|
-
setup_i18n
|
22
|
-
require_relative 'command/scp'
|
23
|
-
Command
|
24
|
-
end
|
25
|
-
|
26
20
|
synced_folder('scp', 5) do
|
27
21
|
require_relative 'synced_folder'
|
28
22
|
SyncedFolder
|
@@ -69,6 +63,11 @@ module VagrantPlugins
|
|
69
63
|
# from the parent logger.
|
70
64
|
setup_logging
|
71
65
|
setup_i18n
|
66
|
+
|
67
|
+
command('scp') do
|
68
|
+
require_relative 'command/scp'
|
69
|
+
Command::ScpSyncCommand
|
70
|
+
end
|
72
71
|
end
|
73
72
|
end
|
74
73
|
end
|
data/locales/en.yml
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
en:
|
2
2
|
vagrant_scp_sync:
|
3
3
|
action:
|
4
|
-
scp_sync_folder:
|
5
|
-
Syncing Folder: %{source_files} ==> %{target_files}
|
6
|
-
|
4
|
+
scp_sync_folder: "Syncing files: %{source_files} ==> %{target_files}"
|
7
5
|
errors:
|
8
6
|
not_yet_implemented: |-
|
9
7
|
Configuration is not yet implemented
|
@@ -39,6 +37,13 @@ en:
|
|
39
37
|
Full command causing error:
|
40
38
|
%{command}
|
41
39
|
|
40
|
+
scp_sync_folder_error: |-
|
41
|
+
There was an error when attemping to sync folders using scp.
|
42
|
+
Please inspect the error message below for more info.
|
43
|
+
Error: %{stderr}
|
44
|
+
Full command causing error:
|
45
|
+
%{command}
|
46
|
+
|
42
47
|
scp_sync_error: |-
|
43
48
|
There was an error when attemping to sync folders using scp.
|
44
49
|
Please inspect the error message below for more info.
|