eco-helpers 2.0.61 → 2.0.62
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/lib/eco/api/common/session/sftp.rb +24 -3
- data/lib/eco/api/session/config/sftp.rb +9 -1
- 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: a20dea65d12f12a2f98885339f146445b0286456389114514a174ca43cc5e8b6
|
4
|
+
data.tar.gz: 3eed3dab1682206b9b4c54ce62033f5de6c6136558863eff86904cb5d5104744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e14376e092ede7eabec60cc804bad014bdcacaf424f32475b391111992552a9ebcffb644690db8ef232ddd3e1280ffa700bdec6dae54bc39c50d9718ee29938
|
7
|
+
data.tar.gz: 7174c43b7c13c6b9b83c054e6b187947ec91160a1149451b988f8fdc0ac50d1b75a982ea105f7d21f64a4cc2ec02ef4655cd178e366a9543456dc1ff1bf0d995
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,18 @@
|
|
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.62] - 2022-07-15
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- SFTP **password** option
|
8
|
+
- `Eco::API::Common::Session::Sftp` fetches from config
|
9
|
+
- `Eco::API::Session::Config::Sftp#password`
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
### Fixed
|
13
|
+
- `Eco::API::UseCases::DefaultCases::CreateCase` had a typo
|
14
|
+
|
15
|
+
## [2.0.61] - 2022-07-11
|
5
16
|
|
6
17
|
### Added
|
7
18
|
- 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
|
@@ -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