webhdfs 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/webhdfs/client_v1.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d66d42e71b87236b2c3724f9d30b282ed01a5bd42ec471a56af560e494ce425
|
4
|
+
data.tar.gz: 9c230c32273448bc62e8359fe0849189e5ffcabb3adf15951c3f0c4614ea2e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f034571c3ba98a201df86159e0ab60a8f17359d5f6dc8d761e1a06370f40dd66ce166418d13c4ffe860078a33d528ea11c5c1d558c41d03d637cc89f8a96c698
|
7
|
+
data.tar.gz: b198731f0f369bcd83ba931babe7ec6d145975ef4138eb7c2515ff169c962e64767313bb10668bd73db4d4e1e5e2210ef2da2da406a10d51c53098616875ac82
|
data/README.md
CHANGED
@@ -102,8 +102,8 @@ Note that net/https and openssl libraries must be available:
|
|
102
102
|
Note that [gssapi](https://github.com/zenchild/gssapi) library must be available:
|
103
103
|
|
104
104
|
client = WebHDFS::Client.new('hostname', 14000)
|
105
|
-
# or if you want to use client delegation token with renewing per 8 hours
|
106
|
-
client = WebHDFS::Client.new('hostname', 14000, username, nil, nil, nil, {}, 8)
|
105
|
+
# or if you want to use client delegation token with renewing per 8 hours and delegation token max-lifetime is 7 days
|
106
|
+
client = WebHDFS::Client.new('hostname', 14000, username, nil, nil, nil, {}, 8, 168)
|
107
107
|
|
108
108
|
client.kerberos = true
|
109
109
|
client.kerberos_keytab = "/path/to/project.keytab"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
data/lib/webhdfs/client_v1.rb
CHANGED
@@ -2,7 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'uri'
|
3
3
|
require 'json'
|
4
4
|
require 'addressable/uri'
|
5
|
-
|
5
|
+
require "base64"
|
6
6
|
require_relative 'exceptions'
|
7
7
|
|
8
8
|
module WebHDFS
|
@@ -38,7 +38,7 @@ module WebHDFS
|
|
38
38
|
@ssl_verify_mode = mode
|
39
39
|
end
|
40
40
|
|
41
|
-
def initialize(host='localhost', port=50070, username=nil, doas=nil, proxy_address=nil, proxy_port=nil, http_headers={}, renew_kerberos_delegation_token_time_hour=nil)
|
41
|
+
def initialize(host='localhost', port=50070, username=nil, doas=nil, proxy_address=nil, proxy_port=nil, http_headers={}, renew_kerberos_delegation_token_time_hour=nil,kerberos_delegation_token_max_lifetime_hour=nil)
|
42
42
|
@host = host
|
43
43
|
@port = port
|
44
44
|
@username = username
|
@@ -61,21 +61,27 @@ module WebHDFS
|
|
61
61
|
@kerberos = false
|
62
62
|
@kerberos_keytab = nil
|
63
63
|
@renew_kerberos_delegation_token_time_hour = renew_kerberos_delegation_token_time_hour
|
64
|
+
@kerberos_delegation_token_max_lifetime_hour = kerberos_delegation_token_max_lifetime_hour
|
64
65
|
@kerberos_delegation_token = nil
|
66
|
+
@kerberos_token_created_at = Time.now
|
65
67
|
@kerberos_token_updated_at = Time.now
|
66
68
|
@http_headers = http_headers
|
67
69
|
end
|
68
70
|
|
69
71
|
def should_kerberos_token_updated?
|
70
|
-
@kerberos_token_updated_at + (@renew_kerberos_delegation_token_time_hour * 60 * 60) <= Time.now
|
72
|
+
(@kerberos_token_updated_at + (@renew_kerberos_delegation_token_time_hour * 60 * 60) <= Time.now) || is_delegation_token_lifetime_expired?
|
71
73
|
end
|
72
74
|
|
75
|
+
def is_delegation_token_lifetime_expired?
|
76
|
+
(@kerberos_token_created_at + (@kerberos_delegation_token_max_lifetime_hour * 60 * 60 ) <= Time.now)
|
77
|
+
end
|
73
78
|
|
74
79
|
def get_cached_kerberos_delegation_token(force_renew=nil)
|
75
80
|
return @kerberos_delegation_token if @kerberos_delegation_token && !should_kerberos_token_updated? && !force_renew
|
76
81
|
|
77
|
-
if !@kerberos_delegation_token || force_renew
|
82
|
+
if !@kerberos_delegation_token || force_renew || is_delegation_token_lifetime_expired?
|
78
83
|
@kerberos_delegation_token = get_kerberos_delegation_token(@username)
|
84
|
+
@kerberos_token_created_at = Time.now
|
79
85
|
@kerberos_token_updated_at = Time.now
|
80
86
|
else
|
81
87
|
renew_kerberos_delegation_token(@kerberos_delegation_token)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhdfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuki Ohta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.4.10
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Ruby WebHDFS/HttpFs client
|