eco-helpers 2.0.61 → 2.0.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/lib/eco/api/common/session/sftp.rb +24 -3
- data/lib/eco/api/session/config/sftp.rb +10 -3
- data/lib/eco/api/usecases/default_cases/create_case.rb +1 -1
- data/lib/eco/version.rb +1 -1
- 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: 6f44a1f53c7b227a340ea3e009984f987cde4aab1b85fc6c0ba919e41840d49b
|
4
|
+
data.tar.gz: 063d30eca08b9f72942db955f88aa43541ff628a9bd4242c632e298763942711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb52a12acf882f712b6bba0e4989655200f7d6d37548b5035353e772c217fef33553646e57f3946b0b00273587327d0633cf2b11376247a17978d092bbc3d0ed
|
7
|
+
data.tar.gz: 64c0b639a0a591f43e6f310a82ca6e9f9f6b014445dd4f8782463f7f47aaa8a5aa46352afa9194f3d57b9ee44374d5ba665cf858850c01f87cdda04cae8d5553
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.0.
|
4
|
+
## [2.0.64] - 2022-08-xx
|
5
|
+
|
6
|
+
### Added
|
7
|
+
### Changed
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
## [2.0.63] - 2022-08-11
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- `Eco::API::Session::Config::SFTP#remote_folder` to use native path builder
|
14
|
+
|
15
|
+
## [2.0.62] - 2022-07-15
|
16
|
+
|
17
|
+
### Added
|
18
|
+
- SFTP **password** option
|
19
|
+
- `Eco::API::Common::Session::Sftp` fetches from config
|
20
|
+
- `Eco::API::Session::Config::Sftp#password`
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
### Fixed
|
24
|
+
- `Eco::API::UseCases::DefaultCases::CreateCase` had a typo
|
25
|
+
|
26
|
+
## [2.0.61] - 2022-07-11
|
5
27
|
|
6
28
|
### Added
|
7
29
|
- patch for `Ecoportal::API::Common::Client#host` exposed `host` property
|
@@ -16,9 +16,7 @@ module Eco
|
|
16
16
|
@sftp_session ||= Net::SFTP.start(
|
17
17
|
fetch_host,
|
18
18
|
fetch_user,
|
19
|
-
|
20
|
-
keys_only: true,
|
21
|
-
non_interactive: true
|
19
|
+
**session_options
|
22
20
|
)
|
23
21
|
rescue Exception => e
|
24
22
|
msg = "Could not open SFTP session. Possible misconfiguration: #{e}"
|
@@ -85,6 +83,21 @@ module Eco
|
|
85
83
|
|
86
84
|
private
|
87
85
|
|
86
|
+
def session_options
|
87
|
+
{
|
88
|
+
non_interactive: true
|
89
|
+
}.tap do |opts|
|
90
|
+
if password?
|
91
|
+
opts.merge!({password: fetch_password})
|
92
|
+
else
|
93
|
+
opts.merge!({
|
94
|
+
keys: fetch_key_files,
|
95
|
+
keys_only: true
|
96
|
+
})
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
88
101
|
def windows_basename(remote_fullname)
|
89
102
|
parts = remote_fullname.split(/[\\\/]/).map {|node| node.gsub(/[<>:\\\/\|?*]/, '_')}
|
90
103
|
local_fullname = File.join(*parts)
|
@@ -107,6 +120,14 @@ module Eco
|
|
107
120
|
config.sftp.user || ENV['SFTP_USERNAME']
|
108
121
|
end
|
109
122
|
|
123
|
+
def password?
|
124
|
+
!!fetch_password
|
125
|
+
end
|
126
|
+
|
127
|
+
def fetch_password
|
128
|
+
config.sftp.password || ENV['SFTP_PASSWORD']
|
129
|
+
end
|
130
|
+
|
110
131
|
def fetch_key_files
|
111
132
|
[config.sftp.key_file || ENV['SFTP_KEY_FILE']]
|
112
133
|
end
|
@@ -5,7 +5,7 @@ module Eco
|
|
5
5
|
class SFTP < BaseConfig
|
6
6
|
|
7
7
|
def configured?
|
8
|
-
required = host && user && key_file
|
8
|
+
required = host && user && (key_file || password)
|
9
9
|
!!required
|
10
10
|
end
|
11
11
|
|
@@ -25,6 +25,14 @@ module Eco
|
|
25
25
|
self["user"]
|
26
26
|
end
|
27
27
|
|
28
|
+
def password=(var)
|
29
|
+
self["password"] = var
|
30
|
+
end
|
31
|
+
|
32
|
+
def password
|
33
|
+
self["password"]
|
34
|
+
end
|
35
|
+
|
28
36
|
def key_file=(key)
|
29
37
|
self["key_file"] = key
|
30
38
|
end
|
@@ -54,9 +62,8 @@ module Eco
|
|
54
62
|
end
|
55
63
|
|
56
64
|
def remote_folder
|
57
|
-
base_path
|
65
|
+
File.join(*[base_path, enviro_subpath].compact)
|
58
66
|
end
|
59
|
-
|
60
67
|
end
|
61
68
|
end
|
62
69
|
end
|
@@ -5,7 +5,7 @@ class Eco::API::UseCases::DefaultCases::CreateCase < Eco::API::Common::Loaders::
|
|
5
5
|
attr_reader :options
|
6
6
|
|
7
7
|
def main(entries, people, session, options, usecase)
|
8
|
-
options
|
8
|
+
@options = options
|
9
9
|
micro = session.micro
|
10
10
|
creation = session.new_job("main", "create", :create, usecase)
|
11
11
|
supers = session.new_job("post", "supers", :update, usecase, :core)
|
data/lib/eco/version.rb
CHANGED