sparoid 1.0.16 → 1.0.17

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: 11677eb6c66244eed7b68e11a2d543db02020701b990a3fdec1c6e230df7f883
4
- data.tar.gz: 3a3c8c05b72ae568bf7edb0ff95e37fa60cb9173380283e626f07455d24e9064
3
+ metadata.gz: 8747bc66fcbc1b4f3e31d7246d2608298a882df7d5661aef6d51c7f7b99f406c
4
+ data.tar.gz: 99e0f9044333f8d17e022f406e519abcd9977c420a86003fb4d69d891ba92475
5
5
  SHA512:
6
- metadata.gz: bc14a72d7d060bad1b0bb813987a66c9464e89cb8e8dcd58cff28a91130560d91e3a5d5c49182be4465f0a8d3499f7d87e564a78b1abcf2576c4aa0bc3610550
7
- data.tar.gz: b9dffb39f58ae71e43a54aa1417c0a1f69e25f398c6354497243b01a2f5604c26023624dffc33c3b55b7f8065c29789ef34f252298feb3f883d44ac5cc58f19a
6
+ metadata.gz: 16095424a1dce5589c2922191ce96a380dd0e973dcc77c1715ec0fe9af376b4caf3127645808c2d87a161797d7d929135fa80d32be8fd06e7ef14a86cefad72f
7
+ data.tar.gz: 2a56181b6d57bc511ea35e10128f9536ad4bc480fb8fae007facd5e2ee7feb8cee3a7b4aeae910b1c03c5670b20de35f7f470e495d1b5a57dd3b5a422f0cc288
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.0.17] - 2021-11-15
2
+
3
+ - Raise more specific error when failing to resolv hostname
4
+
1
5
  ## [1.0.16] - 2021-08-23
2
6
 
3
7
  - Resolv host IPs before generating message (in case resolving takes a lot of time)
data/lib/sparoid/cli.rb CHANGED
@@ -6,6 +6,8 @@ require_relative "../sparoid"
6
6
  module Sparoid
7
7
  # CLI
8
8
  class CLI < Thor
9
+ map "-v" => :version
10
+
9
11
  desc "auth HOST [PORT]", "Send a authorization packet"
10
12
  method_option :config, desc: "Path to a config file, INI format, with key and hmac-key", default: "~/.sparoid.ini"
11
13
  def auth(host, port = 8484)
@@ -34,6 +36,11 @@ module Sparoid
34
36
  Sparoid.keygen
35
37
  end
36
38
 
39
+ desc "version", "Show version and exit"
40
+ def version
41
+ puts "#{Sparoid::VERSION} (ruby)"
42
+ end
43
+
37
44
  def self.exit_on_failure?
38
45
  true
39
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sparoid
4
- VERSION = "1.0.16"
4
+ VERSION = "1.0.17"
5
5
  end
data/lib/sparoid.rb CHANGED
@@ -14,7 +14,7 @@ module Sparoid
14
14
  # Send an authorization packet
15
15
  def auth(key, hmac_key, host, port)
16
16
  ips = Resolv.getaddresses(host)
17
- raise(Error, "Sparoid failed to resolv #{host}") if ips.empty?
17
+ raise(ResolvError, "Sparoid failed to resolv #{host}") if ips.empty?
18
18
 
19
19
  msg = message(cached_public_ip)
20
20
  data = prefix_hmac(hmac_key, encrypt(key, msg))
@@ -131,6 +131,8 @@ module Sparoid
131
131
 
132
132
  class Error < StandardError; end
133
133
 
134
+ class ResolvError < Error; end
135
+
134
136
  # Instance of SPAroid that only resolved public_ip once
135
137
  class Instance
136
138
  include Sparoid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Hörberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.2.15
72
+ rubygems_version: 3.1.4
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: Single Packet Authorisation client