rig 0.3.7 → 0.4.1

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.
@@ -13,6 +13,12 @@ dns_zone: blah.com
13
13
  # this is the key that you will use to SSH to the server
14
14
  keypair: keyname
15
15
 
16
+ # security groups to use when creating instances
17
+ # groups configuration precedence:
18
+ # template instances -> template -> account -> config
19
+ # groups:
20
+ # - default
21
+
16
22
  # Common settings.
17
23
  # In most cases, you will be using the same provider
18
24
  # for all of the different components within your
data/conf/config.yml CHANGED
@@ -1,50 +1,32 @@
1
-
2
- rig:
3
-
4
- # if you're using chef, set this to the knife.rb configuration file
5
- # this will allow Rig to manage the chef nodes, environments and such.
6
- #
7
- #chef:
8
- # knife: /path/to/chef/knife.rb
9
-
10
- #TODO: Figure out the same thing for puppet
11
-
12
- ssh:
13
- # user to connect as, when ssh'ing to server
14
- # AWS defaults to the user "ubuntu"
15
- user: ubuntu
16
-
17
- # the account to use if one is not specified
18
- default_account: default
19
-
20
- # uncomment this and specify the accounts you want to support
21
- # all others will be filtered from use.
22
- #accounts:
23
- # - default
24
- # - production
25
-
26
- # configuration overrides
27
- # these values override those in the templates
28
-
29
- # DNS zone to manage
30
- # generally, this should be set in the account
31
- #dns_zone: blah.com
32
-
33
- # the default region to use
34
- # accounts can specify different regions
35
- # meaning you can have a different rig account
36
- # file for each deployment region
37
- region: us-east-1
38
-
39
- # AWS images (AMI's) are different per region
40
- # for ubuntu, go to: http://cloud.ubuntu.com/ami/
41
- image:
42
- us-east-1: ami-8baa73e2 # ubuntu 11.10, non-ebs storage
43
-
44
- # this is the key that you will use to SSH to the server
45
- # keypair in account takes precedence
46
- keypair: keyname
47
-
48
- # specifying a flavor here will force all instances to
49
- # be that flavor, overrides flavor in template
50
- #flavor: m1.large
1
+ # the account to use if one is not specified on the command line
2
+ :default_account: default
3
+
4
+ # uncomment this and specify the accounts you want to support
5
+ # all others will be filtered from use.
6
+ #:accounts:
7
+ # - default
8
+ # - production
9
+
10
+ # ssh options for "rig ssh" command
11
+ :ssh:
12
+ # user to connect as, when ssh'ing to server
13
+ # AWS defaults to the user "ubuntu"
14
+ :user: ubuntu
15
+
16
+ # if you're using chef, set this to the knife.rb configuration file
17
+ # this will allow Rig to manage the chef nodes, environments, etc.
18
+ #
19
+ #:chef:
20
+ # :knife: /path/to/chef/knife.rb
21
+
22
+ #TODO: Figure out the same thing for puppet
23
+
24
+ #
25
+ # DO NOT PUT ACCOUNT RELATED INFORMATION
26
+ # IN THIS FILE. IT WILL BE IGNORED.
27
+ #
28
+ # This file contains only Rig configuration.
29
+ # Anything related to cloud accounts and
30
+ # provisioning should be stored in the accounts
31
+ # configuration files.
32
+ #
@@ -7,10 +7,20 @@
7
7
  :count: 3
8
8
  :flavor: c1.large
9
9
  :balance: true
10
+ :listeners:
11
+ - :from: HTTP:80
12
+ :to: HTTP:80
13
+ - :from: HTTPS:443
14
+ :to: HTTP:80
15
+ :cert: arn:cert:name
10
16
  :webserver:
11
17
  :count: 3
12
18
  :flavor: c1.large
13
19
  :balance: true
14
- :primary: true
15
- :groups:
16
- - default
20
+ :listeners:
21
+ - :from: HTTP:80
22
+ :to: HTTP:80
23
+ - :from: HTTPS:443
24
+ :to: HTTP:80
25
+ :cert: arn:cert:name
26
+ :primary: true
@@ -1,17 +1,13 @@
1
1
  ---
2
2
  :instances:
3
- - :solo:
3
+ - :appserver:
4
4
  :count: 1
5
5
  :flavor: c1.medium
6
6
  :balance: true
7
- #[{"PolicyNames"=>[], "Listener"=>{"InstancePort"=>80, "SSLCertificateId"=>nil, "Protocol"=>"HTTP", "LoadBalancerPort"=>80, "InstanceProtocol"=>"HTTP"}}]
8
- #{"ListenerDescriptions"=>[{"PolicyNames"=>[], "Listener"=>{"InstancePort"=>80, "SSLCertificateId"=>nil, "Protocol"=>"HTTP", "LoadBalancerPort"=>80, "InstanceProtocol"=>"HTTP"}}]}
7
+ :primary: true
9
8
  :listeners:
10
9
  - :from: HTTP:80
11
10
  :to: HTTP:80
12
11
  - :from: HTTPS:443
13
12
  :to: HTTP:80
14
- :cert: inqlabs.com
15
- :primary: true
16
- :groups:
17
- - default
13
+ :cert: arn:cert:name
@@ -9,8 +9,8 @@ require 'capistrano'
9
9
  module Rig
10
10
  module Capistrano
11
11
  def servers
12
- env = ENV['ENVIRONMENT'] || Rig.config.environment
13
- role = ENV['ROLE'] || Rig.config.role
12
+ env = ENV['ENVIRONMENT'] || Rig.config[:environment]
13
+ role = ENV['ROLE'] || Rig.config[:role]
14
14
  servers = Rig::Model::Environment.find(env).servers
15
15
  list = role == 'all' ? servers : servers.select { |s| s.tags['Role'] == role }
16
16
 
@@ -31,15 +31,10 @@ configuration = Capistrano::Configuration.respond_to?(:instance) ?
31
31
  Capistrano.configuration(:must_exist)
32
32
 
33
33
  configuration.load do
34
-
35
34
  puts " * reading rig information..."
36
35
 
37
- set :environments, Rig::Model::Environment.list
38
- set :servers, Rig::Model::Instance.running
39
- set :rigroles, servers.collect { |s| s.tags['Role'] }.compact
40
-
41
- Rig.config.environment = ARGV[0]
42
- Rig.config.role = ARGV[1]
36
+ Rig.config[:environment] = ARGV[0]
37
+ Rig.config[:role] = ARGV[1]
43
38
 
44
39
  # create dummy tasks for environment and role
45
40
  begin
data/lib/rig/chef.rb CHANGED
@@ -10,7 +10,7 @@ module Rig
10
10
  module Chef
11
11
  class << self
12
12
  def configure
13
- @chef ||= ::Chef::Config.from_file(File.expand_path(Rig.config.chef.knife))
13
+ @chef ||= ::Chef::Config.from_file(File.expand_path(Rig.config[:chef][:knife]))
14
14
  end
15
15
 
16
16
  def environment_create(name)
data/lib/rig/command.rb CHANGED
@@ -23,6 +23,7 @@ require 'rig/command/balancer/main'
23
23
  require 'rig/command/balancer/list'
24
24
  require 'rig/command/balancer/view'
25
25
  require 'rig/command/balancer/destroy'
26
+ require 'rig/command/balancer/listener'
26
27
 
27
28
  require 'rig/command/dns/main'
28
29
  require 'rig/command/dns/list'
@@ -4,12 +4,12 @@ module Rig
4
4
  module Command
5
5
  class Abstract < Clamp::Command
6
6
  option ["-n", "--test"], :flag, "use Fog.mock! to test command without creating / destroying cloud resources" do |o|
7
- Rig.config.mock = true
7
+ Rig.config[:mock] = true
8
8
  Fog.mock!
9
9
  end
10
10
 
11
11
  option ["-a", "--account"], "ACCOUNT", "set the rig account to use", :default => "default" do |a|
12
- Rig.config.account = a
12
+ Rig.config[:account] = a
13
13
  a
14
14
  end
15
15
 
@@ -6,7 +6,7 @@ module Rig
6
6
  list = Rig::Model::Account.list
7
7
  rows = []
8
8
  list.each do |n, f|
9
- rows << [(Rig.config.default_account == n.to_s), (Rig.account.name == n.to_s), n, f]
9
+ rows << [(Rig.config[:default_account] == n.to_s), (Rig.account[:name] == n.to_s), n, f]
10
10
  end
11
11
  print_table(%w{Default Current Name Location}, rows)
12
12
  end
@@ -20,16 +20,16 @@ module Rig
20
20
  # def execute
21
21
  # case property
22
22
  # when "awsid"
23
- # Rig.account.common.aws_access_key_id = value
23
+ # Rig.account[:common][:aws_access_key_id] = value
24
24
  # Rig.save_account
25
25
  # when "awskey"
26
- # Rig.account.common.aws_secret_access_key = value
26
+ # Rig.account[:common][:aws_secret_access_key] = value
27
27
  # Rig.save_account
28
28
  # when "dnszone"
29
- # Rig.account.dns_zone = value
29
+ # Rig.account[:dns_zone] = value
30
30
  # Rig.save_account
31
31
  # when "region"
32
- # Rig.account.region = value
32
+ # Rig.account[:region] = value
33
33
  # Rig.save_account
34
34
  # else
35
35
  # puts "Property #{property} not supported"
@@ -0,0 +1,31 @@
1
+ module Rig
2
+ module Command
3
+ module Listener
4
+ class Main < Abstract
5
+ subcommand "add", "add a listener to a balancer" do
6
+ parameter "BALANCER", "balancer name"
7
+ parameter "LISTENER", "listener data PROTO:PORT/PROTO:PORT"
8
+ parameter "[CERT]", "arn for server certificate"
9
+ parameter "[POLICY] ...", "policy names"
10
+
11
+ def execute
12
+ (from, to) = listener.split('/')
13
+ #newlist = elb.listeners.create()
14
+ Rig::Model::Balancer.add_listener(balancer, from, to, cert, policy_list)
15
+ end
16
+ end
17
+
18
+ subcommand "rm", "remove a listener from a balancer" do
19
+ parameter "BALANCER", "balancer name"
20
+ parameter "LISTENER", "listener data PROTO:PORT (just the elb side)"
21
+
22
+ def execute
23
+ Rig::Model::Balancer.destroy_listener(balancer, listener)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ Rig::Command::Balancer::Main.subcommand "listener", "manage balancer listeners (protocols and ports", Rig::Command::Listener::Main
@@ -8,10 +8,10 @@ module Rig
8
8
  def execute
9
9
  case property
10
10
  when "knife"
11
- Rig.config.chef.knife = value
11
+ Rig.config[:chef][:knife] = value
12
12
  Rig.save_configuration
13
13
  when "user"
14
- Rig.config.ssh.user = value
14
+ Rig.config[:ssh][:user] = value
15
15
  Rig.save_configuration
16
16
  else
17
17
  puts "Property #{property} not supported"
@@ -5,8 +5,6 @@ module Rig
5
5
  module Command
6
6
  module Environment
7
7
  class Create < Abstract
8
- include Options::AwsKey
9
- include Options::AwsSecret
10
8
 
11
9
  parameter "NAME", "the name of the environment"
12
10
  parameter "TEMPLATE", "the template to use (solo, multi, etc)", :default => "solo"
@@ -4,20 +4,12 @@ module Rig
4
4
  module Command
5
5
  module Instance
6
6
  class Create < Abstract
7
- include Options::Config
8
7
 
9
- include Options::AwsKey
10
- include Options::AwsSecret
11
- include Options::AwsRegion
12
- include Options::AwsAmi
13
- include Options::AwsKeypair
14
-
15
- parameter "CLUSTER", "the cluster this instance should belong to"
16
8
  parameter "ENVIRONMENT", "the environment this instance should belong to"
17
9
  parameter "ROLE", "the instance role", :default => 'solo'
18
10
 
19
11
  def execute
20
- puts "create: ami:#{ami} region:#{region} keypair:#{keypair} cluster:#{cluster} env:#{environment} role:#{role}"
12
+ puts "create: env:#{environment} role:#{role}"
21
13
  end
22
14
  end
23
15
  end
@@ -4,7 +4,6 @@ module Rig
4
4
  module Command
5
5
  module Instance
6
6
  class Destroy < Abstract
7
- include Options::Config
8
7
 
9
8
  parameter "NAME", "the name of the instance to connect to"
10
9
 
@@ -3,7 +3,6 @@ module Rig
3
3
  module Instance
4
4
  module Tag
5
5
  class Get < Abstract
6
- include Options::Config
7
6
 
8
7
  parameter "NAME", "the name of the instance to get tags for"
9
8
 
@@ -4,12 +4,12 @@ module Rig
4
4
  module Instance
5
5
  module Tag
6
6
  class Remove < Abstract
7
- include Options::Config
8
7
  include Options::Instance
9
8
  include Options::InstanceName
10
9
 
11
10
  parameter "TAG", "tag key to remove", :attribute_name => :raw_tag
12
11
 
12
+ # TODO: fix this to use Model instead
13
13
  def execute
14
14
  unless iname || iid
15
15
  raise "Must set either instance name or instance id (-iname or -iid)"
@@ -3,7 +3,6 @@ module Rig
3
3
  module Instance
4
4
  module Tag
5
5
  class Set < Abstract
6
- include Options::Config
7
6
  include Options::Instance
8
7
  include Options::InstanceName
9
8
 
@@ -6,7 +6,7 @@ module Rig
6
6
 
7
7
  subcommand "chef", "test chef configuration" do
8
8
  def execute
9
- raise "chef not configured" unless Rig.config.chef
9
+ raise "chef not configured" unless Rig.config[:chef]
10
10
 
11
11
  list = Rig::Chef.client_list
12
12
  rows = []
@@ -5,70 +5,6 @@ module Rig
5
5
  module Command
6
6
  module Options
7
7
 
8
- module Config
9
- #def self.included(base)
10
- # base.class_eval do
11
- # option %w{-c --config}, "CONFIG", "configuration file" do |f|
12
- # e = File.expand_path(f)
13
- # raise "Config file #{f} (#{e}) does not exist" unless File.exists?(e)
14
- # e
15
- # end
16
- # def default_config
17
- # ENV['RIG_CONFIG'] || "~/.rig"
18
- # end
19
- # end
20
- #end
21
- end
22
-
23
- module AwsKey
24
- def self.included(base)
25
- base.class_eval do
26
- option %w{-k --key}, "KEY", "aws access key id"
27
- end
28
- end
29
- end
30
-
31
- module AwsSecret
32
- def self.included(base)
33
- base.class_eval do
34
- option %w{-s --secret}, "SECRET", "aws secret access key"
35
- end
36
- end
37
- end
38
-
39
- module AwsAmi
40
- def self.included(base)
41
- base.class_eval do
42
- option %w{--ami}, "AMI", "aws ami id"
43
- def default_ami
44
- ENV['RIG_AWS_AMI'] || Rig.config.ami || nil
45
- end
46
- end
47
- end
48
- end
49
-
50
- module AwsRegion
51
- def self.included(base)
52
- base.class_eval do
53
- option %w{--region}, "AMI", "aws region"
54
- def default_region
55
- ENV['RIG_AWS_REGION'] || Rig.config.region || nil
56
- end
57
- end
58
- end
59
- end
60
-
61
- module AwsKeypair
62
- def self.included(base)
63
- base.class_eval do
64
- option %w{--keypair}, "KEYPAIR", "aws key pair name"
65
- def default_keypair
66
- ENV['RIG_AWS_KEYPAIR'] || Rig.config.keypair || nil
67
- end
68
- end
69
- end
70
- end
71
-
72
8
  module Instance
73
9
  def self.included(base)
74
10
  base.class_eval do
@@ -3,7 +3,7 @@ module Rig
3
3
  class Ssh < Abstract
4
4
  parameter "NAME", "name of the host. <role><#>.<env>, eg: solo1.stable for the first solo role in environment stable"
5
5
  def execute
6
- user = Rig.config.ssh.user rescue nil
6
+ user = Rig.config[:ssh][:user] rescue nil
7
7
  unless user
8
8
  puts "must set rig:ssh:user in configuration."
9
9
  exit(1)
data/lib/rig/config.rb CHANGED
@@ -8,14 +8,14 @@ module Rig
8
8
 
9
9
  def config
10
10
  @configuration ||= begin
11
- c = Rig::Oconfig.load_yaml_file("#{configdir}/config.yml")
11
+ c = YAML::load_file("#{configdir}/config.yml")
12
12
 
13
13
  # prevent Chef and Capistrano being loaded at the same time
14
14
  # requirements on net-ssh conflict (chef ~> 2.1.4)
15
15
  #
16
16
  # this makes it so we don't have to use bundler to run
17
17
  # rig and cap together.
18
- if c.chef && !defined?(Rig::Capistrano)
18
+ if c[:chef] && !defined?(Rig::Capistrano)
19
19
  require 'rig/chef'
20
20
  end
21
21
 
@@ -36,13 +36,13 @@ module Rig
36
36
  def account(name=get_account)
37
37
  @account ||= begin
38
38
  a = Rig::Model::Account.load(name)
39
- a.name = name
39
+ a[:name] = name
40
40
  a
41
41
  end
42
42
  end
43
43
 
44
44
  def save_account
45
- name = Rig.account.name
45
+ name = Rig.account[:name]
46
46
  Rig::Model::Account.save(name, Rig.account)
47
47
  end
48
48
 
@@ -56,9 +56,9 @@ module Rig
56
56
 
57
57
  def get_account
58
58
  return ENV['RIG_ACCOUNT'] if ENV['RIG_ACCOUNT']
59
- return Rig.config.account if Rig.config.account
60
- return Rig.config.default_account if Rig.config.default_account
61
- return Rig.config.accounts.first if Rig.config.accounts.count > 0
59
+ return Rig.config[:account] if Rig.config[:account]
60
+ return Rig.config[:default_account] if Rig.config[:default_account]
61
+ return Rig.config[:accounts].first if Rig.config[:accounts] && Rig.config[:accounts].count > 0
62
62
  "default"
63
63
  end
64
64
 
@@ -1,9 +1,9 @@
1
1
  module Rig
2
2
  module Model
3
- class Account < Rig::Oconfig
3
+ class Account
4
4
  class << self
5
5
  def load(name)
6
- self.load_yaml_file("#{dir}/#{name}.yml")
6
+ YAML::load_file("#{dir}/#{name}.yml")
7
7
  end
8
8
 
9
9
  def list
@@ -1,5 +1,3 @@
1
- require 'fog/aws/models/elb/listeners'
2
- require 'fog/aws/models/elb/load_balancers'
3
1
  require 'awesome_print'
4
2
 
5
3
  module Rig
@@ -13,10 +11,10 @@ module Rig
13
11
  def new(name, listeners=[])
14
12
  listeners.map! do |listener|
15
13
  ld = new_listener_description(listener)
16
- ap ld
14
+ #ap ld
17
15
  ld
18
16
  end
19
- ap listeners
17
+ #ap listeners
20
18
  Rig::Connection.balancer.load_balancers.new({ :id => name, "ListenerDescriptions" => listeners })
21
19
  end
22
20
 
@@ -44,27 +42,60 @@ module Rig
44
42
  end
45
43
  end
46
44
 
47
- private
48
-
49
- def new_listener_description(listener)
50
- desc = { }
51
- (from_proto, from_port) = listener[:from].split(/:/)
52
- (to_proto, to_port) = listener[:to].split(/:/)
53
- sslcert = listener[:cert] || nil
54
- policy_names = listener[:policy_names] || []
45
+ def new_listener(from, to, cert=nil, policy_names=nil)
46
+ new_listener_description({ :from => from, :to => to, :cert => cert, :policy_names => policy_names })
47
+ end
55
48
 
56
- new_listener = Fog::AWS::ELB::Listener.new(
49
+ def add_listener(name, from, to, cert, policy_list)
50
+ elb = find(name)
51
+ (from_proto, from_port) = from.split(':')
52
+ (to_proto, to_port) = to.split(':')
53
+ sslcert = cert || nil
54
+ policy_names = policy_list || []
55
+ new_listener = elb.listeners.new(
57
56
  :policy_names => policy_names,
58
57
  :instance_port => to_port,
59
58
  :instance_protocol => to_proto,
60
59
  :lb_port => from_port,
61
60
  :protocol => from_proto,
62
- :ssl_id => sslcert
61
+ :ssl_id => sslcert,
62
+ :load_balancer => elb
63
63
  )
64
+ new_listener.save
65
+ end
66
+
67
+ def destroy_listener(name, from)
68
+ elb = find(name)
69
+ (from_proto, from_port) = from.split(':')
70
+ match = elb.listeners.select {|l| l.protocol == from_proto && l.lb_port == from_port.to_i }
71
+ if match.count > 1
72
+ puts "more than one listener matched"
73
+ match.each do |l|
74
+ ap l.attributes
75
+ end
76
+ return
77
+ end
78
+ match.first.destroy
79
+ end
80
+
81
+ private
82
+
83
+ def new_listener_description(listener)
84
+ (from_proto, from_port) = listener[:from].split(/:/)
85
+ (to_proto, to_port) = listener[:to].split(/:/)
86
+ sslcert = listener[:cert] || nil
87
+ policy_names = listener[:policy_names] || []
64
88
 
65
89
  {
66
- 'Listener' => new_listener.to_params,
67
- 'PolicyNames' => new_listener.policy_names
90
+ 'Listener' => {
91
+ "Protocol" => from_proto,
92
+ "LoadBalancerPort" => from_port,
93
+ "InstanceProtocol" => to_proto,
94
+ "InstancePort" => to_port,
95
+ "SSLCertificateId" => sslcert,
96
+ "PolicyNames" => policy_names
97
+ },
98
+ 'PolicyNames' => policy_names
68
99
  }
69
100
  end
70
101
  end
@@ -6,18 +6,18 @@ module Rig
6
6
  class << self
7
7
  def compute
8
8
  @compute ||= begin
9
- Fog::Compute.new(Rig.account.compute.to_hash)
9
+ Fog::Compute.new(Rig.account[:compute])
10
10
  end
11
11
  end
12
12
  def balancer
13
13
  @balancer ||= begin
14
- #Fog::Compute.new(
15
- Fog::AWS::ELB.new(Rig.account.balancer.to_hash)
14
+ #TODO: figure out the standardized way of handling balancers
15
+ Fog::AWS::ELB.new(Rig.account[:balancer])
16
16
  end
17
17
  end
18
18
  def dns
19
19
  @dns ||= begin
20
- Fog::DNS.new(Rig.account.dns.to_hash)
20
+ Fog::DNS.new(Rig.account[:dns])
21
21
  end
22
22
  end
23
23
  end
@@ -10,29 +10,6 @@ module Rig
10
10
  attr_reader :region
11
11
  attr_reader :flavor
12
12
 
13
- #TEMPLATES = {
14
- # :solo => {
15
- # :groups => %w{app-server db-inqcloud-dev},
16
- # :instances => [
17
- # :solo => {
18
- # :flavor => 'c1.medium',
19
- # :count => 1,
20
- # :balance => true,
21
- # :primary => true
22
- # }
23
- # ]
24
- # },
25
- # :multi => {
26
- # :groups => %w{app-server db-inqcloud-dev},
27
- # :instances => [
28
- # :harvester => { :flavor => 'c1.large', :count => 3, :image => "ami-faketest" },
29
- # :queue => { :flavor => 'c1.medium', :count => 3 },
30
- # :cache => { :flavor => 'm1.medium', :count => 3 },
31
- # :app => { :flavor => 'c1.large', :count => 3, :balance => true, :primary => true }
32
- # ]
33
- # }
34
- #}
35
-
36
13
  class << self
37
14
  def list
38
15
  filters = { }
@@ -69,16 +46,11 @@ module Rig
69
46
  #TODO: overall, need better handling for global config, template and local overrides
70
47
  def initialize(name, template=nil, opts={ })
71
48
  @options = {
72
- :region => Rig.config.region,
49
+
73
50
  }.merge(opts)
74
51
 
75
52
  @name = name
76
53
  @template_name = template
77
- #@region = @options[:region]
78
- ##TODO: allow global config setting for image (in AWS, the ami)
79
- #@image = @options[:image] # || Rig.config.compute.image[@region] || Rig.config.compute.image
80
- ##TODO: allow global config setting for flavor (in AWS, the size, like: m1.large)
81
- #@flavor = @options[:flavor] # || Rig.config.flavor[@region] || Rig.config.flavor
82
54
  @servers = []
83
55
  @balancers = []
84
56
  end
@@ -97,7 +69,7 @@ module Rig
97
69
  count = tmpl[:count] || 1
98
70
  count.times do |i|
99
71
  n = "#{role}#{i+1}.#{name}.env"
100
- chef = Rig.config.chef ? true : false
72
+ chef = Rig.config[:chef] ? true : false
101
73
 
102
74
  o = {
103
75
  :image_id => tmpl[:image] || @image,
@@ -148,7 +120,7 @@ module Rig
148
120
  end
149
121
 
150
122
  # if we've got a chef config, use it
151
- if Rig.config.chef
123
+ if Rig.config[:chef]
152
124
  puts "creating chef environment"
153
125
  Rig::Chef.environment_create(name)
154
126
  end
@@ -198,7 +170,7 @@ module Rig
198
170
  puts "destroying balancers"
199
171
  Rig::Model::Balancer.destroy(@balancers)
200
172
 
201
- if Rig.config.chef
173
+ if Rig.config[:chef]
202
174
  puts "destroying chef environment"
203
175
  Rig::Chef.environment_destroy(name)
204
176
  end
@@ -218,23 +190,22 @@ module Rig
218
190
 
219
191
  def load_config
220
192
  @region = @options[:region] ||
221
- Rig.get_config(:region) ||
193
+ Rig.account[:region] ||
222
194
  nil
223
195
  @image = @options[:image] ||
224
- Rig.account.image ||
225
- Rig.config.image.kind_of?(Oconfig) ? Rig.config.image[@region] : Rig.config.image ||
196
+ Rig.account[:image].is_a?(Hash) ? Rig.account[:image][@region.to_sym] : Rig.account[:image] ||
226
197
  nil
227
198
  @flavor = @options[:flavor] ||
228
- Rig.get_config(:flavor) ||
199
+ Rig.account[:flavor] ||
229
200
  nil
230
201
  @zone = @options[:dns_zone] ||
231
- Rig.get_config(:dns_zone) ||
202
+ Rig.account[:dns_zone] ||
232
203
  nil
233
204
  @keypair = @options[:keypair] ||
234
- Rig.get_config(:keypair) ||
205
+ Rig.account[:keypair] ||
235
206
  nil
236
207
  @groups = @options[:groups] ||
237
- Rig.get_config(:groups) ||
208
+ Rig.account[:groups] ||
238
209
  nil
239
210
  end
240
211
 
@@ -53,7 +53,7 @@ module Rig
53
53
  puts ".. destroying: #{ids.inspect}"
54
54
 
55
55
  # if we've got a chef config, use it
56
- if Rig.config.chef
56
+ if Rig.config[:chef]
57
57
  list.each do |e|
58
58
  Rig::Chef.client_delete(e.tags['Name']) if e.tags['Name']
59
59
  Rig::Chef.node_delete(e.tags['Name']) if e.tags['Name']
data/lib/rig/version.rb CHANGED
@@ -2,8 +2,8 @@ unless defined?(Rig::Version)
2
2
  module Rig
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 3
6
- TINY = 7
5
+ MINOR = 4
6
+ TINY = 1
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
9
  end
data/rig.gemspec CHANGED
@@ -34,6 +34,4 @@ Gem::Specification.new do |gem|
34
34
  # print awesome
35
35
  gem.add_dependency "awesome_print"
36
36
 
37
- # Ruby Object Notation - easy config objects
38
- #gem.add_dependency "ribbon"
39
37
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rig
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 7
10
- version: 0.3.7
8
+ - 4
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shawn Catanzarite
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-02 00:00:00 Z
18
+ date: 2012-05-08 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: clamp
@@ -129,6 +129,7 @@ files:
129
129
  - lib/rig/command/account.rb
130
130
  - lib/rig/command/balancer/destroy.rb
131
131
  - lib/rig/command/balancer/list.rb
132
+ - lib/rig/command/balancer/listener.rb
132
133
  - lib/rig/command/balancer/main.rb
133
134
  - lib/rig/command/balancer/view.rb
134
135
  - lib/rig/command/config.rb
@@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
198
  requirements: []
198
199
 
199
200
  rubyforge_project:
200
- rubygems_version: 1.8.21
201
+ rubygems_version: 1.8.24
201
202
  signing_key:
202
203
  specification_version: 3
203
204
  summary: Cloud provisioning tool built on ruby fog