dynect-utils 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ PATH
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- dynect_rest (0.4.0)
11
+ dynect_rest (0.4.3)
12
12
  json
13
13
  json
14
14
  rest-client
@@ -5,6 +5,7 @@ require "rubygems"
5
5
  require "bundler/setup"
6
6
 
7
7
  require "dynect_rest"
8
+ require "timeout"
8
9
  require "trollop"
9
10
 
10
11
  progname = File.basename($0)
@@ -22,10 +23,23 @@ opts = Trollop::options do
22
23
  :required => true
23
24
  opt :region, "GSLB region", :short => "-R", :type => :string,
24
25
  :default => "global"
26
+ opt :timeout, "Dynect API timeout", :short => "-t", :type => :integer,
27
+ :default => 10
25
28
  end
26
29
 
27
- dyn = DynectRest.new(opts[:customer], opts[:user], opts[:pass], opts[:zone])
28
- gslb = dyn.get("GSLB/#{opts[:zone]}/#{opts[:record]}")
30
+ gslb = nil
31
+ begin
32
+ Timeout::timeout(opts[:timeout]) do
33
+ dyn = DynectRest.new(opts[:customer], opts[:user], opts[:pass], opts[:zone])
34
+ gslb = dyn.get("GSLB/#{opts[:zone]}/#{opts[:record]}")
35
+ end
36
+ rescue Timeout::Error, Errno::ENETUNREACH => e
37
+ puts "UNKNOWN: dynect api timed out (#{$!})"
38
+ exit 3
39
+ rescue DynectRest::Exceptions::RequestFailed => e
40
+ puts "UNKNOWN: dynect api error, #{$!}"
41
+ exit 3
42
+ end
29
43
 
30
44
  region = gslb["region"].select { |r| r["region_code"] == opts[:region] }.first
31
45
  if region.nil?
@@ -3,14 +3,13 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "dynect-utils"
6
- s.version = "0.0.1"
6
+ s.version = "0.0.2"
7
7
  s.authors = ["Pete Fritchman"]
8
8
  s.email = ["petef@databits.net"]
9
9
  s.homepage = "https://github.com/fetep/dynect-utils"
10
10
  s.summary = %q{Utilities to interact with the DynECT API}
11
- s.description = %q{
12
- Utilities included: nagios plugin to check GSLB status, tool to manipulate
13
- the serving mode of GSLB addresses
11
+ s.description = %q{Utilities included: nagios plugin to check GSLB status,
12
+ tool to manipulate the serving mode of GSLB addresses
14
13
  }
15
14
 
16
15
  s.rubyforge_project = "dynect-utils"
metadata CHANGED
@@ -1,73 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynect-utils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
5
+ version: 0.0.2
11
6
  platform: ruby
12
7
  authors:
13
- - Pete Fritchman
8
+ - Pete Fritchman
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2012-03-07 00:00:00 Z
13
+ date: 2012-06-20 00:00:00 Z
19
14
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: dynect_rest
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: trollop
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
46
- type: :runtime
47
- version_requirements: *id002
15
+ - !ruby/object:Gem::Dependency
16
+ name: dynect_rest
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: trollop
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id002
48
37
  description: |
49
-
50
- Utilities included: nagios plugin to check GSLB status, tool to manipulate
51
- the serving mode of GSLB addresses
38
+ Utilities included: nagios plugin to check GSLB status,
39
+ tool to manipulate the serving mode of GSLB addresses
52
40
 
53
41
  email:
54
- - petef@databits.net
42
+ - petef@databits.net
55
43
  executables:
56
- - check_dynect_gslb_region
57
- - dynect_gslb_manage
44
+ - check_dynect_gslb_region
45
+ - dynect_gslb_manage
58
46
  extensions: []
59
47
 
60
48
  extra_rdoc_files: []
61
49
 
62
50
  files:
63
- - .gitignore
64
- - Gemfile
65
- - Gemfile.lock
66
- - README.md
67
- - Rakefile
68
- - bin/check_dynect_gslb_region
69
- - bin/dynect_gslb_manage
70
- - dynect-utils.gemspec
51
+ - .gitignore
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - README.md
55
+ - Rakefile
56
+ - bin/check_dynect_gslb_region
57
+ - bin/dynect_gslb_manage
58
+ - dynect-utils.gemspec
71
59
  homepage: https://github.com/fetep/dynect-utils
72
60
  licenses: []
73
61
 
@@ -75,29 +63,23 @@ post_install_message:
75
63
  rdoc_options: []
76
64
 
77
65
  require_paths:
78
- - lib
66
+ - lib
79
67
  required_ruby_version: !ruby/object:Gem::Requirement
80
68
  none: false
81
69
  requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
88
73
  required_rubygems_version: !ruby/object:Gem::Requirement
89
74
  none: false
90
75
  requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
97
79
  requirements: []
98
80
 
99
81
  rubyforge_project: dynect-utils
100
- rubygems_version: 1.8.10
82
+ rubygems_version: 1.8.15
101
83
  signing_key:
102
84
  specification_version: 3
103
85
  summary: Utilities to interact with the DynECT API