dyntool 0.2.7 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/dyntool.rb +70 -22
- metadata +18 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6020ca92c28a77d5fd1af9a1eb11262f07a1002b
|
4
|
+
data.tar.gz: ef915a9e4933f5fa18a3cee6583f1c1f51af8787
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a02012df674306b6c58c812f6b3276332567881183cc6ac077316aebad7e6d308a3c2e7c4ac2923fe3da32288bb5408fc06980614752e0a2fe5ddb818c291559
|
7
|
+
data.tar.gz: a53112f9d52465aaff0db392ea84e33376322eb00cdc0e51b7e0458f32acab3995e31bc2dc189550b473f593f43abe3db9ead5ab88eddc8e029ac8aaefc53346
|
data/lib/dyntool.rb
CHANGED
@@ -7,15 +7,23 @@ require 'ipaddr'
|
|
7
7
|
require 'highline/import'
|
8
8
|
require 'yaml'
|
9
9
|
require 'time'
|
10
|
+
require 'ftools'
|
10
11
|
### class for loading and retrieving configuration from dyn.yml
|
11
12
|
class LoadConfig
|
12
13
|
def SetConfFile
|
13
14
|
@pwd = Dir.pwd
|
14
15
|
@confFile = "#{@pwd}/dyn.yml"
|
15
16
|
end
|
17
|
+
def SetTmpFile
|
18
|
+
@pwd = Dir.pwd
|
19
|
+
@confFile = "#{@pwd}/status.yml"
|
20
|
+
end
|
16
21
|
def GetHandler
|
17
22
|
@conf = YAML.load_file(@confFile)
|
18
23
|
end
|
24
|
+
def GetTmpHandler
|
25
|
+
@conf = YAML.load_file(@tmpFile)
|
26
|
+
end
|
19
27
|
def GetDcs
|
20
28
|
@dcs = @conf['sites']['names']
|
21
29
|
end
|
@@ -31,6 +39,12 @@ class LoadConfig
|
|
31
39
|
def GetDcProviders(dc)
|
32
40
|
@dcproviders = @conf['sites'][dc]
|
33
41
|
end
|
42
|
+
def SetDcProviders(dc,providers)
|
43
|
+
@conf['sites'][dc] = providers
|
44
|
+
File.open("#{@confFile}",'w') do |out|
|
45
|
+
YAML.dump(@conf,out)
|
46
|
+
end
|
47
|
+
end
|
34
48
|
def GetProvierIP(provider)
|
35
49
|
@providerip = @conf['providers'][provider]
|
36
50
|
end
|
@@ -40,6 +54,12 @@ class LoadConfig
|
|
40
54
|
def GetDcsEnabled(region,service)
|
41
55
|
@dcs = @conf[service][region]
|
42
56
|
end
|
57
|
+
def SetDcsEnabled(region,service,dcs)
|
58
|
+
@conf[service][region] = dcs
|
59
|
+
File.open("#{@confFile}",'w') do |out|
|
60
|
+
YAML.dump(@conf,out)
|
61
|
+
end
|
62
|
+
end
|
43
63
|
def GetIpLabel(ip)
|
44
64
|
@iplabel = @conf['ips'][ip]['label']
|
45
65
|
end
|
@@ -58,6 +78,22 @@ class LoadConfig
|
|
58
78
|
def GetNotifyApps
|
59
79
|
@apps = @conf['notify_apps']
|
60
80
|
end
|
81
|
+
def ConfManipulate(shiftfrom,shifto)
|
82
|
+
@confile = "./dyn.yml"
|
83
|
+
@tmpfile = "./status.yml"
|
84
|
+
if [shiftfrom == ""] && [shifto == ""]
|
85
|
+
if File.file?(@tmpfile)
|
86
|
+
File.delete(@tmpfile)
|
87
|
+
end
|
88
|
+
@rfile = "temp"
|
89
|
+
else
|
90
|
+
if File.file?(@tmpfile)
|
91
|
+
File.copy(@confile,@tmpfile)
|
92
|
+
end
|
93
|
+
@rfile = "dyn"
|
94
|
+
end
|
95
|
+
return(@rfile)
|
96
|
+
end
|
61
97
|
end
|
62
98
|
## Getting authentication creds from users
|
63
99
|
class Utils
|
@@ -413,46 +449,46 @@ class Parameters
|
|
413
449
|
|
414
450
|
* add: Adding a new record *
|
415
451
|
|
416
|
-
add a fqdn(a) ip example: dynamo.rb add a mynode.example.com 11.12.13.14
|
417
|
-
add cname fqdn(cname) fqdn(a) example: dynamo.rb add cname mycnamenode.example.com mynode.example.com
|
418
|
-
add txt fqdn(a) "some text" example: dynamo.rb add txt mynode.example.com "this is some text"
|
419
|
-
add zone zonename example: dynamo.rb add zone example2.com
|
452
|
+
add a fqdn(a) ip example: dynamo.rb add a mynode.example.com 11.12.13.14 -m "some comment"
|
453
|
+
add cname fqdn(cname) fqdn(a) example: dynamo.rb add cname mycnamenode.example.com mynode.example.com -m "some comment"
|
454
|
+
add txt fqdn(a) "some text" example: dynamo.rb add txt mynode.example.com "this is some text" -m "some comment"
|
455
|
+
add zone zonename example: dynamo.rb add zone example2.com -m "some comment"
|
420
456
|
|
421
457
|
|
422
458
|
* del: Deleting a node or service *
|
423
459
|
|
424
|
-
del node fqdn(node) - node can be a,cname,txt,geonode,etc example: dynamo.rb del node mynode.example.com
|
425
|
-
del service geoservice example: dynamo.rb del service geo17
|
460
|
+
del node fqdn(node) - node can be a,cname,txt,geonode,etc example: dynamo.rb del node mynode.example.com -m "some comment"
|
461
|
+
del service geoservice example: dynamo.rb del service geo17 -m "some comment"
|
426
462
|
|
427
463
|
|
428
464
|
* change: Changing a record *
|
429
465
|
|
430
|
-
change cname cname newfqdn example: dynamo.rb change cname mycnamenode.example.com test19.example.com
|
466
|
+
change cname cname newfqdn example: dynamo.rb change cname mycnamenode.example.com test19.example.com -m "some comment"
|
431
467
|
|
432
468
|
|
433
469
|
* generate: Generating Geo service from yaml *
|
434
470
|
|
435
|
-
generate geoservice geonode example: dynamo.rb generate geo11 test11.example.com
|
471
|
+
generate geoservice geonode example: dynamo.rb generate geo11 test11.example.com -m "some comment"
|
436
472
|
|
437
473
|
|
438
474
|
* shift: Shifting traffic from dc or from provider on geo service *
|
439
475
|
|
440
|
-
shift geoservice from dc/provider to dc/dcs/provider(in same dc) example1: dynamo.rb shift geo11 from dc chidc1 to nydc1
|
441
|
-
example2: dynamo.rb shift geo11 from dc chidc1 to nydc1 ladc1
|
442
|
-
example2: dynamo.rb shift all from dc chidc1 to nydc1 ladc1
|
443
|
-
example3: dynamo.rb shift geo15 from provider amc_chi to inap_chi
|
476
|
+
shift geoservice from dc/provider to dc/dcs/provider(in same dc) example1: dynamo.rb shift geo11 from dc chidc1 to nydc1 -m "some comment"
|
477
|
+
example2: dynamo.rb shift geo11 from dc chidc1 to nydc1 ladc1 -m "some comment"
|
478
|
+
example2: dynamo.rb shift all from dc chidc1 to nydc1 ladc1 -m "some comment"
|
479
|
+
example3: dynamo.rb shift geo15 from provider amc_chi to inap_chi -m "some comment"
|
444
480
|
|
445
481
|
* revert: Reverting a state of geo service to yaml state *
|
446
482
|
|
447
|
-
revert geoservice example: dynamo.rb revert geo15
|
448
|
-
example: dynamo.rb revert all
|
483
|
+
revert geoservice example: dynamo.rb revert geo15 -m "some comment"
|
484
|
+
example: dynamo.rb revert all -m "some comment"
|
449
485
|
|
450
486
|
|
451
487
|
* get: Getting infotmation of geo services, geonodes, cname pointing to geo *
|
452
488
|
|
453
|
-
get services (get all geo services) example: dynamo.rb get services
|
454
|
-
get node geonode example: dynamo.rb get node test1.example.com
|
455
|
-
get cname cname example: dynamo.rb get cname mycnamenode.example.com
|
489
|
+
get services (get all geo services) example: dynamo.rb get services -m "some comment"
|
490
|
+
get node geonode example: dynamo.rb get node test1.example.com -m "some comment"
|
491
|
+
get cname cname example: dynamo.rb get cname mycnamenode.example.com -m "some comment"
|
456
492
|
EOF
|
457
493
|
exit(2)
|
458
494
|
end
|
@@ -626,15 +662,21 @@ class OperateDyn
|
|
626
662
|
# building the record_data hash for generating geo service in dyn API
|
627
663
|
def BuildService(service,flag,shiftfrom,shifto)
|
628
664
|
puts "Generating the geo service data"
|
629
|
-
@@conf = LoadConfig.new()
|
630
|
-
@@conf.SetConfFile
|
631
|
-
@@conf.GetHandler
|
632
|
-
@regions = @@conf.GetRegions
|
633
|
-
@dcs = @@conf.GetDcs
|
634
665
|
@shiftfrom = []
|
635
666
|
@shifto = []
|
636
667
|
@shiftfrom << shiftfrom
|
637
668
|
@shifto = shifto.split("-")
|
669
|
+
@@conf = LoadConfig.new()
|
670
|
+
@ftype = @@conf.ConfManipulate(shiftfrom,shifto)
|
671
|
+
if @ftype == "dyn"
|
672
|
+
@@conf.SetConfFile
|
673
|
+
@@conf.GetHandler
|
674
|
+
else
|
675
|
+
@@conf.SetTmpFile
|
676
|
+
@@conf.GetTmpHandler
|
677
|
+
end
|
678
|
+
@regions = @@conf.GetRegions
|
679
|
+
@dcs = @@conf.GetDcs
|
638
680
|
@region_hash = []
|
639
681
|
@i = 0
|
640
682
|
@regions.each do |region|
|
@@ -648,6 +690,9 @@ class OperateDyn
|
|
648
690
|
@dcs = @dcs - @shiftfrom
|
649
691
|
@dcs = @dcs + @shifto
|
650
692
|
end
|
693
|
+
if @ftype == "temp"
|
694
|
+
@conf.SetDcsEnabled(region,service,@dcs)
|
695
|
+
end
|
651
696
|
end
|
652
697
|
if @dcs.nil?
|
653
698
|
abort("The region #{region}, has empty dc list. aborting....")
|
@@ -662,6 +707,9 @@ class OperateDyn
|
|
662
707
|
@providers = @providers - @shiftfrom
|
663
708
|
@providers = @providers + @shifto
|
664
709
|
end
|
710
|
+
if @ftype == "temp"
|
711
|
+
SetDcProviders(dc,@providers)
|
712
|
+
end
|
665
713
|
end
|
666
714
|
@providers.each do |provider|
|
667
715
|
@ips += @@conf.GetProvierIP(provider)
|
metadata
CHANGED
@@ -1,62 +1,43 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyntool
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 7
|
9
|
-
version: 0.2.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Ariel Moskovich
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2014-01-24 00:00:00 +02:00
|
18
|
-
default_executable:
|
11
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description: Tool for manipulation dyn dns records
|
22
14
|
email: ariel@outbrain.com
|
23
15
|
executables: []
|
24
|
-
|
25
16
|
extensions: []
|
26
|
-
|
27
17
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
18
|
+
files:
|
30
19
|
- lib/dyntool.rb
|
31
|
-
has_rdoc: true
|
32
20
|
homepage: http://rubygems.org/gems/dyntool
|
33
21
|
licenses: []
|
34
|
-
|
22
|
+
metadata: {}
|
35
23
|
post_install_message:
|
36
24
|
rdoc_options: []
|
37
|
-
|
38
|
-
require_paths:
|
25
|
+
require_paths:
|
39
26
|
- lib
|
40
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
42
29
|
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
-
requirements:
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
49
34
|
- - ">="
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
|
52
|
-
- 0
|
53
|
-
version: "0"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
54
37
|
requirements: []
|
55
|
-
|
56
38
|
rubyforge_project:
|
57
|
-
rubygems_version:
|
39
|
+
rubygems_version: 2.2.2
|
58
40
|
signing_key:
|
59
|
-
specification_version:
|
41
|
+
specification_version: 4
|
60
42
|
summary: Dyn tools
|
61
43
|
test_files: []
|
62
|
-
|