uhlenbrock-slicehost-tools 0.0.5 → 0.0.6

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/README.markdown CHANGED
@@ -17,23 +17,26 @@ I am not responsible if this eats your data or destroys your life. YOU HAVE BEEN
17
17
 
18
18
  slicehost-dns
19
19
 
20
- add [DOMAIN] [IP] add a domain for the given ip
21
- google_apps [DOMAIN] [IP] cofigure Google Apps for the given domain (new or existing)
22
- list lists all zones and their associated records
23
- delete [DOMAIN] removes a domain
24
- apikey [APIKEY] set your Slicehost API Key and save it to ~/.slicehost-tools
25
- help [TASK] describe available tasks or one specific task
20
+ add [DOMAIN] [IP] add a domain for the given ip
21
+ google_apps [DOMAIN] [IP] configure Google Apps for the given domain (new or existing)
22
+ add_a [DOMAIN] [NAME] [IP] add a A record to an existing domain
23
+ add_assets [DOMAIN] [IP] add a 4 assets hosts (assets0..assets3) to an existing domain
24
+ add_cname [DOMAIN] [NAME] [CNAME] add a CNAME record to an existing domain
25
+ list lists all zones and their associated records
26
+ delete [DOMAIN] removes a domain
27
+ apikey [APIKEY] set your Slicehost API Key and save it to ~/.slicehost-tools
28
+ to_zonefile [DOMAIN] output a zone file for the given domain
29
+ help [TASK] describe available tasks or one specific task
26
30
 
27
31
  slicehost-slice
28
32
 
29
- add [SLICE NAME] [--force] add a new slice
30
- delete [SLICE] delete a slice
31
- list list slices
32
- hard_reboot [SLICE] perform a hard reboot
33
- soft_reboot [SLICE] perform a soft reboot
34
- apikey [APIKEY] set your Slicehost API Key and save it to ~/.slicehost-tools
35
- help [TASK] describe available tasks or one specific task
36
-
33
+ add [SLICE NAME] [--force] add a new slice
34
+ delete [SLICE] delete a slice
35
+ list list slices
36
+ hard_reboot [SLICE] perform a hard reboot
37
+ soft_reboot [SLICE] perform a soft reboot
38
+ apikey [APIKEY] set your Slicehost API Key and save it to ~/.slicehost-tools
39
+ help [TASK] describe available tasks or one specific task
37
40
 
38
41
  ## TODO
39
42
 
data/Rakefile CHANGED
@@ -4,15 +4,15 @@ require 'rake/gempackagetask'
4
4
 
5
5
  gem_spec = Gem::Specification.new do |s|
6
6
  s.name = %q{slicehost-tools}
7
- s.version = "0.0.5"
7
+ s.version = "0.0.6"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Cameron Cox", "Bobby Uhlenbrock"]
13
- s.date = %q{2008-09-02}
12
+ s.authors = ["Cameron Cox", "Bobby Uhlenbrock", "Corey Martella"]
13
+ s.date = %q{2008-09-10}
14
14
  s.summary = %q{tools utilizing the slicehost api}
15
- s.email = %q{cameroncox@gmail.com}
15
+ s.email = %q{bobby@uhlenbrock.us}
16
16
  s.executables = ["slicehost-dns", "slicehost-slice"]
17
17
  s.extra_rdoc_files = ["README.markdown", "LICENSE"]
18
18
  s.files = Dir['**/**'].reject{ |f| f =~ /pkg/i }
@@ -14,6 +14,7 @@ end
14
14
 
15
15
  class Record < Resource
16
16
  def self.to_zone_rr(options = {})
17
- "%-20s %-10s IN %-10s %s" % [options[:name], options[:ttl], options[:type], options[:data]]
17
+ id = "; ID=#{options[:id]}" if options[:id]
18
+ "%-20s %-10s IN %-10s %-25s %s" % [options[:name], options[:ttl], options[:type], options[:data], id]
18
19
  end
19
20
  end
@@ -65,14 +65,14 @@ module Tools
65
65
  end
66
66
  end
67
67
 
68
- desc "tozonefile", "output a zone file for the given domain"
69
- def tozonefile(domain = nil)
68
+ desc "to_zonefile", "output a zone file for the given domain"
69
+ def to_zonefile(domain = nil)
70
70
  abort "You must give a domain" if domain.nil?
71
71
  zone = Zone.find_by_origin(domain)
72
72
 
73
73
  puts "\$ORIGIN #{zone.origin.sub(/\.$/, '')}"
74
74
  puts "\$TTL #{zone.ttl}"
75
- puts "@ IN SOA ns.slicehost.net. #{ENV['USER']}.#{zone.origin} ("
75
+ puts "@ IN SOA ns.slicehost.net. hostmaster.#{zone.origin} ("
76
76
  puts " %-14s ; serial number" % Time.now.strftime('%Y%m%d%H%M%S')
77
77
  puts " %-14s ; time to refresh" % '1d'
78
78
  puts " %-14s ; time to retry" % '1d'
@@ -108,7 +108,8 @@ module Tools
108
108
  when 'TXT'
109
109
  data = "\"#{record.data}\""
110
110
  end
111
- puts Record.to_zone_rr(:name => name,
111
+ puts Record.to_zone_rr(:id => record.id,
112
+ :name => name,
112
113
  :ttl => ttl,
113
114
  :type => record.record_type,
114
115
  :data => data)
@@ -135,7 +136,70 @@ module Tools
135
136
  end
136
137
  end
137
138
 
139
+ desc "add_a [DOMAIN] [NAME] [IP]", "Add an A record to an existing domain"
140
+ def add_a(domain=nil,name=nil,ip=nil)
141
+ unless domain
142
+ puts "Please give a domain to configure:"
143
+ domain = STDIN.gets.chomp
144
+ end
145
+ #lookup the zone
146
+ unless zone = Zone.find(:first, :params => { :origin => "#{domain}." })
147
+ error "Zone #{domain} does not exist, use slicetool-dns add #{domain} IP first!"
148
+ end
149
+ unless name
150
+ puts "Please give a name to configure:"
151
+ name = STDIN.gets.chomp
152
+ end
153
+ unless ip
154
+ puts "Please give a IP to map:"
155
+ ip = STDIN.gets.chomp
156
+ end
157
+ Record.new( :record_type => 'A', :zone_id => zone.id, :name => name, :data => "#{ip}" ).save
158
+ puts "Added #{name} ==> #{ip} to #{domain}"
159
+ end
160
+ desc "add_cname [DOMAIN] [NAME] [CNAME]", "Add a CNAME record to an existing domain"
161
+ def add_cname(domain,name,cname)
162
+ unless domain
163
+ puts "Please give a domain to configure:"
164
+ domain = STDIN.gets.chomp
165
+ end
166
+ #lookup the zone
167
+ unless zone = Zone.find(:first, :params => { :origin => "#{domain}." })
168
+ error "Zone #{domain} does not exist, use slicetool-dns add #{domain} IP first!"
169
+ end
170
+ unless name
171
+ puts "Please give a name to configure:"
172
+ name = STDIN.gets.chomp
173
+ end
174
+ unless cname
175
+ puts "Please give a CNAME to map:"
176
+ cname = STDIN.gets.chomp
177
+ end
178
+ Record.new( :record_type => 'CNAME', :zone_id => zone.id, :name => name, :data => cname ).save
179
+ puts "Added #{name} ==> #{cname} to #{domain}"
180
+ end
181
+ desc "add_assets [DOMAIN] [IP]", "Add a assets0..3 to an existing domain"
182
+
183
+ def add_assets(domain,ip)
184
+ unless domain
185
+ puts "Please give a domain to configure:"
186
+ domain = STDIN.gets.chomp
187
+ end
188
+ #lookup the zone
189
+ unless zone = Zone.find(:first, :params => { :origin => "#{domain}." })
190
+ error "Zone #{domain} does not exist, use slicetool-dns add #{domain} IP first!"
191
+ end
192
+ unless ip
193
+ puts "Please give a IP to map:"
194
+ cname = STDIN.gets.chomp
195
+ end
196
+ 0.upto(3) do |i|
197
+ Record.new( :record_type => 'A', :zone_id => zone.id, :name => "assets#{i}" , :data => ip).save
198
+ end
199
+ puts "Added 4 assets hosts at ip to #{domain}"
200
+ end
138
201
  # init Thor
139
202
  start
203
+
140
204
  end
141
205
  end
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{slicehost-tools}
3
- s.version = "0.0.5"
3
+ s.version = "0.0.6"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Cameron Cox", "Bobby Uhlenbrock"]
9
- s.date = %q{2008-09-02}
8
+ s.authors = ["Cameron Cox", "Bobby Uhlenbrock", "Corey Martella"]
9
+ s.date = %q{2008-09-10}
10
10
  s.summary = %q{tools utilizing the slicehost api}
11
- s.email = %q{cameroncox@gmail.com}
11
+ s.email = %q{bobby@uhlenbrock.us}
12
12
  s.executables = ["slicehost-dns", "slicehost-slice"]
13
13
  s.extra_rdoc_files = ["README.markdown", "LICENSE"]
14
14
  s.files = ["bin", "bin/slicehost-dns", "bin/slicehost-slice", "lib", "lib/slicehost-tools", "lib/slicehost-tools/resources", "lib/slicehost-tools/resources/dns.rb", "lib/slicehost-tools/resources/slice.rb", "lib/slicehost-tools/resources.rb", "lib/slicehost-tools/tools", "lib/slicehost-tools/tools/dns.rb", "lib/slicehost-tools/tools/slice.rb", "lib/slicehost-tools/tools.rb", "lib/slicehost-tools.rb", "LICENSE", "Rakefile", "README.markdown", "slicehost-tools.gemspec"]
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uhlenbrock-slicehost-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Cox
8
8
  - Bobby Uhlenbrock
9
+ - Corey Martella
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2008-09-02 00:00:00 -07:00
14
+ date: 2008-09-10 00:00:00 -07:00
14
15
  default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
@@ -32,7 +33,7 @@ dependencies:
32
33
  version: 2.1.1
33
34
  version:
34
35
  description:
35
- email: cameroncox@gmail.com
36
+ email: bobby@uhlenbrock.us
36
37
  executables:
37
38
  - slicehost-dns
38
39
  - slicehost-slice