dyntool 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dyntool.rb +10 -6
  2. metadata +2 -2
data/lib/dyntool.rb CHANGED
@@ -45,6 +45,9 @@ class LoadConfig
45
45
  def GetIpWeight(ip,region)
46
46
  @weight = @conf['ips'][ip]['weight'][region]
47
47
  end
48
+ def GetContacts
49
+ @contacts = @conf['contacts']
50
+ end
48
51
  end
49
52
  ## Getting authentication creds from users
50
53
  class Utils
@@ -105,14 +108,14 @@ class Parameters
105
108
  @data << " #{user}"
106
109
  @dcs = @sconf.GetDcs
107
110
  @dcs.each do |dc|
108
- @result = `echo "Key73512383ghtyA1109 #{@data} " | nc -w 1 obevent.#{dc}.#{suffix} 7279 2> /dev/null`
111
+ @result = `echo "Key73512383ghtyA1109 #{@data} " | nc -w 1 event.#{dc}.#{suffix} 7279 2> /dev/null`
109
112
  if @result == "accepted"
110
113
  @flag = "true"
111
114
  break
112
115
  end
113
116
  end
114
117
  if @flag == "false"
115
- abort("You are not connected to outbrain network / cant send event to obevent, aborting...")
118
+ abort("You are not connected to outbrain network / cant send event to logstash, aborting...")
116
119
  end
117
120
  end
118
121
  # Opening Session to dyn using creds from the command line
@@ -213,9 +216,10 @@ class Parameters
213
216
  @operate.SetOperation("AddTxtRecord")
214
217
  @operate.SetSession(@session)
215
218
  @operate.SetArgs(@zone,@ARGV[2],@ARGV[3])
216
- when "zone" then @operate.SetOperation("AddZone")
219
+ when "zone" then @contacts = @sconf.GetContacts
220
+ @operate.SetOperation("AddZone")
217
221
  @operate.SetSession(@session)
218
- @operate.SetArgs(@ARGV[2])
222
+ @operate.SetArgs(@ARGV[2],@contacts)
219
223
  end
220
224
  end
221
225
  def ValidateChange
@@ -527,7 +531,7 @@ class OperateDyn
527
531
  def RunOP
528
532
  case(@@op)
529
533
  when "AddARecord" then @@session.AddARecord(@@args[0],@@args[1],@@args[2])
530
- when "AddZone" then @@session.CreateZone(@@args[0])
534
+ when "AddZone" then @@session.CreateZone(@@args[0],@@args[1])
531
535
  when "DeleteNode" then @@session.DeleteNode(@@args[0],@@args[1])
532
536
  when "DeleteService" then @@session.DeleteService(@@args[0])
533
537
  when "AddCnameRecord" then @@session.AddCnameRecord(@@args[0],@@args[1],@@args[2],"post")
@@ -838,7 +842,7 @@ class Restcall
838
842
  @geonode = @result['data']['rdata']['cname'].chomp('.')
839
843
  return(@geonode)
840
844
  end
841
- def CreateZone(zone)
845
+ def CreateZone(zone,contacts)
842
846
  @url = URI.parse("https://api2.dynect.net/REST/Zone/#{zone}/")
843
847
  @record_data = { :rname => "ops@outbrain.com", :ttl => "3600" }
844
848
  PostDyn()
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 20
9
- version: 0.0.20
8
+ - 21
9
+ version: 0.0.21
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ariel Moskovich