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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21aabfeb392bd158c029ee8c1cd2503d0d6686d339333c80757a7fda273e9095
4
- data.tar.gz: 23e15a543b809c2b8b9c0e51e17982da4915c7af170ddb18207b162d74752d22
3
+ metadata.gz: 6f44a1f53c7b227a340ea3e009984f987cde4aab1b85fc6c0ba919e41840d49b
4
+ data.tar.gz: 063d30eca08b9f72942db955f88aa43541ff628a9bd4242c632e298763942711
5
5
  SHA512:
6
- metadata.gz: 777199fdf96345d5a694233c376317b008d6eb25abb736a42a1e8298b354ab7e13198149c81f699fdbc42aa414feaa05b0dd5a75bc34a0e43e75aa6a7c495a70
7
- data.tar.gz: 9bca2a777df96adf7f6245627523f80480ba2e3626d89a179251507998365ca518b927267e381356fa2b9fc287a6593d4f1d60767c94fdd7f724a76b835aee77
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.61] - 2022-07-xx
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
- 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
@@ -54,9 +62,8 @@ module Eco
54
62
  end
55
63
 
56
64
  def remote_folder
57
- base_path + "/" + enviro_subpath
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 = @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.64"
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.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura