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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21aabfeb392bd158c029ee8c1cd2503d0d6686d339333c80757a7fda273e9095
4
- data.tar.gz: 23e15a543b809c2b8b9c0e51e17982da4915c7af170ddb18207b162d74752d22
3
+ metadata.gz: a20dea65d12f12a2f98885339f146445b0286456389114514a174ca43cc5e8b6
4
+ data.tar.gz: 3eed3dab1682206b9b4c54ce62033f5de6c6136558863eff86904cb5d5104744
5
5
  SHA512:
6
- metadata.gz: 777199fdf96345d5a694233c376317b008d6eb25abb736a42a1e8298b354ab7e13198149c81f699fdbc42aa414feaa05b0dd5a75bc34a0e43e75aa6a7c495a70
7
- data.tar.gz: 9bca2a777df96adf7f6245627523f80480ba2e3626d89a179251507998365ca518b927267e381356fa2b9fc287a6593d4f1d60767c94fdd7f724a76b835aee77
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.61] - 2022-07-xx
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
- keys: fetch_key_files,
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 = @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
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.61"
2
+ VERSION = "2.0.62"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.61
4
+ version: 2.0.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura