sr-scripts 0.0.6 → 0.0.7
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/sr-update-dns +19 -0
- data/bin/sr-update-hosts-file +19 -0
- data/lib/sr-scripts/version.rb +1 -1
- metadata +8 -4
data/bin/sr-update-dns
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'fog'
|
5
|
+
|
6
|
+
sdb = Fog::AWS::SimpleDB.new()
|
7
|
+
|
8
|
+
domain = "dns_info"
|
9
|
+
dns_alias = ARGV[0]
|
10
|
+
ip_address = ARGV[1]
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
if /^(\d{1,3}\.){3}\d{1,3}$/.match(ip_address) == nil
|
15
|
+
p "Usage: sr-update-dns hostname ip_address"
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
sdb.put_attributes(domain, dns_alias, { "ip_address" => ip_address }, { :replace => "ip_address" })
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'fog'
|
5
|
+
|
6
|
+
connection = Fog::Compute.new(:provider => "AWS", :region => "us-west-1")
|
7
|
+
sdb = Fog::AWS::SimpleDB.new()
|
8
|
+
|
9
|
+
rows = sdb.select("SELECT * FROM dns_info").body["Items"]
|
10
|
+
|
11
|
+
if rows.length > 0
|
12
|
+
File.open('/etc/hosts', 'w') { |f|
|
13
|
+
f.puts "# THIS FILE MANAGED BY sr-update-hosts SCRIPT"
|
14
|
+
f.puts "127.0.0.1 localhost localhost.localdomain"
|
15
|
+
rows.each_pair { |item_name, values|
|
16
|
+
f.puts "#{values['ip_address']} #{item_name}"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
end
|
data/lib/sr-scripts/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sr-scripts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Davy Campano
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-22 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -26,6 +26,8 @@ executables:
|
|
26
26
|
- sr-backup-mysql
|
27
27
|
- sr-ec2-consistent-snapshot
|
28
28
|
- sr-start-slave
|
29
|
+
- sr-update-dns
|
30
|
+
- sr-update-hosts-file
|
29
31
|
extensions: []
|
30
32
|
|
31
33
|
extra_rdoc_files: []
|
@@ -37,6 +39,8 @@ files:
|
|
37
39
|
- bin/sr-backup-mysql
|
38
40
|
- bin/sr-ec2-consistent-snapshot
|
39
41
|
- bin/sr-start-slave
|
42
|
+
- bin/sr-update-dns
|
43
|
+
- bin/sr-update-hosts-file
|
40
44
|
- lib/sr-scripts.rb
|
41
45
|
- lib/sr-scripts/version.rb
|
42
46
|
- sr-scripts.gemspec
|