dynect4r 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/dynect4r-client +16 -4
- data/lib/dynect4r.rb +13 -12
- metadata +4 -4
data/bin/dynect4r-client
CHANGED
@@ -71,7 +71,7 @@ begin
|
|
71
71
|
(options[:customer_name], options[:user_name], options[:password]) = File.open(options[:cred_file]).readline().strip().split()
|
72
72
|
rescue Errno::ENOENT
|
73
73
|
log.error('Credentials file does not exist: %s' % options[:cred_file])
|
74
|
-
Process.exit(
|
74
|
+
Process.exit(8)
|
75
75
|
end
|
76
76
|
if !options[:zone]
|
77
77
|
options[:zone] = options[:node][(options[:node].index('.') + 1)..-1]
|
@@ -89,7 +89,13 @@ begin
|
|
89
89
|
:password => options[:password])
|
90
90
|
rescue Dynect::DynectError
|
91
91
|
log.error($!.message)
|
92
|
-
Process.exit(
|
92
|
+
Process.exit(2)
|
93
|
+
rescue Errno::ENETUNREACH
|
94
|
+
log.error("Errno::ENETUNREACH "+$!.message)
|
95
|
+
Process.exit(5)
|
96
|
+
rescue
|
97
|
+
log.error("Unknown exception "+$!.message)
|
98
|
+
Process.exit(6)
|
93
99
|
end
|
94
100
|
|
95
101
|
# create set of existing records
|
@@ -115,7 +121,7 @@ rescue Dynect::NotFoundError
|
|
115
121
|
log.info('No records found')
|
116
122
|
rescue Dynect::DynectError
|
117
123
|
log.error('Query for records failed - %s' % $!.message)
|
118
|
-
Process.exit(
|
124
|
+
Process.exit(4)
|
119
125
|
end
|
120
126
|
|
121
127
|
# create set of new records
|
@@ -152,7 +158,7 @@ end
|
|
152
158
|
end
|
153
159
|
changes += 1
|
154
160
|
rescue Dynect::DynectError
|
155
|
-
errors +=
|
161
|
+
errors += 2
|
156
162
|
log.error('Failed to add record - %s' % $!.message)
|
157
163
|
end
|
158
164
|
end
|
@@ -172,6 +178,7 @@ if changes > 0
|
|
172
178
|
end
|
173
179
|
end
|
174
180
|
rescue Dynect::DynectError
|
181
|
+
errors += 4
|
175
182
|
log.error($!.message)
|
176
183
|
end
|
177
184
|
else
|
@@ -183,5 +190,10 @@ log.info('Terminating session')
|
|
183
190
|
begin
|
184
191
|
c.rest_call(:delete, 'Session')
|
185
192
|
rescue Dynect::DynectError
|
193
|
+
errors += 8
|
186
194
|
log.error($!.message)
|
187
195
|
end
|
196
|
+
|
197
|
+
if errors > 0
|
198
|
+
Process.exit(16+errors)
|
199
|
+
end
|
data/lib/dynect4r.rb
CHANGED
@@ -104,31 +104,32 @@ module Dynect
|
|
104
104
|
# raise error based on error code
|
105
105
|
if @hash.has_key?('msgs')
|
106
106
|
@hash['msgs'].each do |msg|
|
107
|
+
m=msg['INFO']+" -- "+@hash.inspect
|
107
108
|
case msg['ERR_CD']
|
108
109
|
when 'ILLEGAL_OPERATION'
|
109
|
-
raise IllegalOperationError,
|
110
|
+
raise IllegalOperationError, m
|
110
111
|
when 'INTERNAL_ERROR'
|
111
|
-
raise InternalErrorError,
|
112
|
+
raise InternalErrorError, m
|
112
113
|
when 'INVALID_DATA'
|
113
|
-
raise InvalidDataError,
|
114
|
+
raise InvalidDataError, m
|
114
115
|
when 'INVALID_REQUEST'
|
115
|
-
raise InvalidRequestError,
|
116
|
+
raise InvalidRequestError, m
|
116
117
|
when 'INVALID_VERSION'
|
117
|
-
raise InvalidVersionError,
|
118
|
+
raise InvalidVersionError, m
|
118
119
|
when 'MISSING_DATA'
|
119
|
-
raise MissingDataError,
|
120
|
+
raise MissingDataError, m
|
120
121
|
when 'NOT_FOUND'
|
121
|
-
raise NotFoundError,
|
122
|
+
raise NotFoundError, m
|
122
123
|
when 'OPERATION_FAILED'
|
123
|
-
raise OperationFailedError,
|
124
|
+
raise OperationFailedError, m
|
124
125
|
when 'PERMISSION_DENIED'
|
125
|
-
raise PermissionDeniedError,
|
126
|
+
raise PermissionDeniedError, m
|
126
127
|
when 'SERVICE_UNAVAILABLE'
|
127
|
-
raise ServiceUnavailableError,
|
128
|
+
raise ServiceUnavailableError, m
|
128
129
|
when 'TARGET_EXISTS'
|
129
|
-
raise TargetExistsError,
|
130
|
+
raise TargetExistsError, m
|
130
131
|
when 'UNKNOWN_ERROR'
|
131
|
-
raise UnknownErrorError,
|
132
|
+
raise UnknownErrorError, m
|
132
133
|
end
|
133
134
|
end
|
134
135
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynect4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael T. Conigliaro
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-06-29 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|