vagrant-openstack-plugin 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: fb275fa87d4601a051b59152af3219c4420bdb78
4
- data.tar.gz: 9acfe025144bf974f4574475ea11457f05d83d14
5
- SHA512:
6
- metadata.gz: 03895c57bd627fba2402596e02eeb2384b137b23c8c6aafa120a97285b6675f923736b01065f0ceed6de4f83d9202dd507b3159d2af31142ce885ef2ae1835de
7
- data.tar.gz: 9836a275ca793adf8168eeb12f851392bc9c1f95d4fbea4f337c1976a1a52bcaa3606037b67bc304580c54e25d0f2e1d9fefcea2599d02461c4c71971798ec91
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0bcbaeca3f9db2c7bc8c3a6895eeb7f3a2f12726
4
+ data.tar.gz: c5598b5a10e611996fb677bd3014b765e0e59bf1
5
+ SHA512:
6
+ metadata.gz: c2237cdfbffdb4b41ef3e5e1b5cfdcd5c8c8d46403645c59d30396e9ee25fcf11e4dd373f875ece6d1aa29e2fa32f5bb1875e912cefb0e820571ce55ad89f1a5
7
+ data.tar.gz: c362a66a69cc6fc6cf2c654de53b5a9c184d8e4f7ff525eaac601673741fb6af6e580241548dd1b323532178046cd8a966f7a1e57d9ae42d5e425d63150fb404
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ langauge: ruby
2
+ script: rake test
3
+ branches:
4
+ only:
5
+ - master
6
+ rvm:
7
+ - 1.9.3
8
+ - 2.0.0
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog for vagrant-openstack-plugin
2
2
 
3
+ ## 0.4.0
4
+
5
+ - fix version
6
+
7
+ ## 0.4.0
8
+
9
+ - Merge pull request #49 from RackerJohnMadrid/fix-rsync-vagrant-1-4 [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/5664ead3fda8f889dad72de1de2fbb
10
+ - fixes the issue of ssh keys now being represented as an Array in vagrant >= 1.4 [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/0741d802a13c4a858
11
+ - fix regression wrt multiple nics [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/9c5441db359b34f2bbf66d30853c97b0896a494b)
12
+ - update README [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/725e66ab7970e5698aa7347dae93f791e926097a)
13
+ - implement multiple networks [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/0bbbda10bc3b6a09e3165936a2cd17d56b9d3159)
14
+ - two minor rsync bugfixes [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/5bf54e8ab99baa850631803137d991a4756f34ab)
15
+ - Merge pull request #33 from johnbellone/master [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/f863781405a1070fe991f55f93d2b37763f6c1da)
16
+ - Add actions for pausing/suspending (and inverse). [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/a5ec0edd25af250599e0e248a25d8a34af0e1c40)
17
+ - Merge pull request #31 from johnbellone/master [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/83031f79e5834693e2c45656c0ae17b6f13afe83)
18
+ - Add a little debugging output. [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/c00310ed8855d3b2b0472ab9304debefbb0918e3)
19
+ - Add travis.yml file to the project. [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/bc53baaa43c2bf652294d374e071c96bf00bcf12)
20
+ - Add proxy option to configuration. [view commit](http://github.com/cloudbau/vagrant-openstack-plugin/commit/3d33bdc9a3bf28af7403bd1a0245a9869799eadc)
21
+
22
+
3
23
  ## 0.3.0 (September 25, 2013)
4
24
 
5
25
  - Adds support to determine IP address to use
data/Gemfile CHANGED
@@ -6,5 +6,5 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
9
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git"
10
10
  end
data/README.md CHANGED
@@ -68,6 +68,7 @@ Vagrant.configure("2") do |config|
68
68
  os.metadata = {"key" => "value"} # optional
69
69
  os.user_data = "#cloud-config\nmanage_etc_hosts: True" # optional
70
70
  os.network = "YOUR NETWORK_NAME" # optional
71
+ os.networks = [ "internal", "external" ] # optional, overrides os.network
71
72
  os.address_id = "YOUR ADDRESS ID" # optional (`network` above has higher precedence)
72
73
  os.scheduler_hints = {
73
74
  :cell => 'australia'
@@ -125,6 +126,7 @@ This provider exposes quite a few provider-specific configuration options:
125
126
  * `network` - A name or id that will be used to fetch network configuration
126
127
  data when configuring the instance. NOTE: This is not compliant with the
127
128
  vagrant network configurations.
129
+ * `networks` - An array of names or ids to create a server with multiple network interfaces. This overrides the `network` setting.
128
130
  * `address_id` - A specific address identifier to use when connecting to the
129
131
  instance. `network` has higher precedence.
130
132
  * `scheduler_hints` - Pass hints to the open stack scheduler, see `--hint` flag in [OpenStack filters doc](http://docs.openstack.org/trunk/openstack-compute/admin/content/scheduler-filters.html)
@@ -133,7 +135,7 @@ This provider exposes quite a few provider-specific configuration options:
133
135
  * `security_groups` - List of security groups to be applied to the machine.
134
136
  * `tenant` - Tenant name. You only need to specify this if your OpenStack user has access to multiple tenants.
135
137
  * `region` - Region Name. Specify the region you want the instance to be launched in for multi-region environments.
136
-
138
+ * `proxy` - HTTP proxy. When behind a firewall override this value for API access.
137
139
 
138
140
  These can be set like typical provider-specific configuration:
139
141
 
@@ -22,9 +22,15 @@ module VagrantPlugins
22
22
  tenant = config.tenant
23
23
  region = config.region
24
24
 
25
+ # Pass proxy config down into the Fog::Connection object using
26
+ # the `connection_options` hash.
27
+ connection_options = { :proxy => config.proxy }
28
+
25
29
  @logger.info("Connecting to OpenStack...")
30
+ @logger.debug("API connection params: #{connection_options.inspect}")
26
31
  env[:openstack_compute] = Fog::Compute.new({
27
32
  :provider => :openstack,
33
+ :connection_options => connection_options,
28
34
  :openstack_username => username,
29
35
  :openstack_api_key => api_key,
30
36
  :openstack_auth_url => endpoint,
@@ -32,9 +38,10 @@ module VagrantPlugins
32
38
  :openstack_region => region
33
39
  })
34
40
 
35
- if config.network
41
+ if config.network || config.networks
36
42
  env[:openstack_network] = Fog::Network.new({
37
43
  :provider => :openstack,
44
+ :connection_options => connection_options,
38
45
  :openstack_username => username,
39
46
  :openstack_api_key => api_key,
40
47
  :openstack_auth_url => endpoint,
@@ -45,11 +45,24 @@ module VagrantPlugins
45
45
  :availability_zone => config.availability_zone
46
46
  }
47
47
 
48
- # Find a network if provided
49
- if config.network
48
+ # Fallback to only one network, otherwise `config.networks` overrides
49
+ unless config.networks
50
+ if config.network
51
+ config.networks = [ config.network ]
52
+ else
53
+ config.networks = []
54
+ end
55
+ end
56
+
57
+ # Find networks if provided
58
+ if config.networks
50
59
  env[:ui].info(I18n.t("vagrant_openstack.finding_network"))
51
- network = find_matching(env[:openstack_network].networks, config.network)
52
- options[:nics] = [{"net_id" => network.id}] if network
60
+ options[:nics] = Array.new
61
+ config.networks.each do |net|
62
+ network = find_matching(env[:openstack_network].networks, net)
63
+ options[:nics] << {"net_id" => network.id} if network
64
+ end
65
+ env[:ui].info("options[:nics]: #{options[:nics]}")
53
66
  end
54
67
 
55
68
  # Output the settings we're going to use to the user
@@ -57,8 +70,8 @@ module VagrantPlugins
57
70
  env[:ui].info(" -- Flavor: #{flavor.name}")
58
71
  env[:ui].info(" -- Image: #{image.name}")
59
72
  env[:ui].info(" -- Name: #{server_name}")
60
- if network
61
- env[:ui].info(" -- Network: #{network.name}")
73
+ config.networks.each do |n|
74
+ env[:ui].info(" -- Network: #{n}")
62
75
  end
63
76
  if config.security_groups
64
77
  env[:ui].info(" -- Security Groups: #{config.security_groups}")
@@ -0,0 +1,25 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module OpenStack
5
+ module Action
6
+ # This pauses a running server, if there is one.
7
+ class PauseServer
8
+ def initialize(app, env)
9
+ @app = app
10
+ @logger = Log4r::Logger.new("vagrant_openstack::action::pause_server")
11
+ end
12
+
13
+ def call(env)
14
+ if env[:machine].id
15
+ env[:ui].info(I18n.t("vagrant_openstack.pausing_server"))
16
+ server = env[:openstack_compute].servers.get(env[:machine].id)
17
+ server.pause
18
+ end
19
+
20
+ @app.call(env)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module OpenStack
5
+ module Action
6
+ # This starts a suspended server, if there is one.
7
+ class ResumeServer
8
+ def initialize(app, env)
9
+ @app = app
10
+ @logger = Log4r::Logger.new("vagrant_openstack::action::resume_server")
11
+ end
12
+
13
+ def call(env)
14
+ if env[:machine].id
15
+ env[:ui].info(I18n.t("vagrant_openstack.resuming_server"))
16
+ server = env[:openstack_compute].servers.get(env[:machine].id)
17
+ server.resume
18
+ end
19
+
20
+ @app.call(env)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module OpenStack
5
+ module Action
6
+ # This deletes the running server, if there is one.
7
+ class SuspendServer
8
+ def initialize(app, env)
9
+ @app = app
10
+ @logger = Log4r::Logger.new("vagrant_openstack::action::suspend_server")
11
+ end
12
+
13
+ def call(env)
14
+ if env[:machine].id
15
+ env[:ui].info(I18n.t("vagrant_openstack.suspending_server"))
16
+ server = env[:openstack_compute].servers.get(env[:machine].id)
17
+ server.suspend
18
+ end
19
+
20
+ @app.call(env)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -43,12 +43,25 @@ module VagrantPlugins
43
43
  "chown #{ssh_info[:username]} '#{guestpath}'")
44
44
 
45
45
  # Rsync over to the guest path using the SSH info
46
+ if env[:machine].config.ssh.proxy_command
47
+ proxy_cmd = "-o ProxyCommand='#{env[:machine].config.ssh.proxy_command}'"
48
+ else
49
+ proxy_cmd = ''
50
+ end
51
+
52
+ # poor workaround for poor ipv6 handling of rsync
53
+ if ssh_info[:host].include? ':'
54
+ user_at_host = "[#{ssh_info[:username]}@#{ssh_info[:host]}]"
55
+ else
56
+ user_at_host = ssh_info[:username] + "@" + ssh_info[:host]
57
+ end
58
+
46
59
  command = [
47
60
  "rsync", "--verbose", "--archive", "-z", "--delete",
48
61
  "--exclude", ".vagrant/",
49
- "-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'",
62
+ "-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{proxy_cmd} #{ssh_key_options(ssh_info)}",
50
63
  hostpath,
51
- "#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
64
+ user_at_host + ":" + guestpath]
52
65
 
53
66
  r = Vagrant::Util::Subprocess.execute(*command)
54
67
  if r.exit_code != 0
@@ -59,6 +72,13 @@ module VagrantPlugins
59
72
  end
60
73
  end
61
74
  end
75
+
76
+ private
77
+
78
+ def ssh_key_options(ssh_info)
79
+ # Ensure that `private_key_path` is an Array (for Vagrant < 1.4)
80
+ Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }.join
81
+ end
62
82
  end
63
83
  end
64
84
  end
@@ -0,0 +1,25 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module OpenStack
5
+ module Action
6
+ # This starts the pause server, if there is one.
7
+ class UnpauseServer
8
+ def initialize(app, env)
9
+ @app = app
10
+ @logger = Log4r::Logger.new("vagrant_openstack::action::unpause_server")
11
+ end
12
+
13
+ def call(env)
14
+ if env[:machine].id
15
+ env[:ui].info(I18n.t("vagrant_openstack.unpausing_server"))
16
+ server = env[:openstack_compute].servers.get(env[:machine].id)
17
+ server.unpause
18
+ end
19
+
20
+ @app.call(env)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -42,6 +42,9 @@ module VagrantPlugins
42
42
  # @return [String]
43
43
  attr_accessor :network
44
44
 
45
+ # @return [Array]
46
+ attr_accessor :networks
47
+
45
48
  # A specific address identifier to use when connecting.
46
49
  # Overrides `network` above if both are set.
47
50
  #
@@ -91,6 +94,11 @@ module VagrantPlugins
91
94
  # @return [String]
92
95
  attr_accessor :region
93
96
 
97
+ # The proxy to specify when making connection to OpenStack API.
98
+ #
99
+ # @return [String]
100
+ attr_accessor :proxy
101
+
94
102
  def initialize
95
103
  @api_key = UNSET_VALUE
96
104
  @endpoint = UNSET_VALUE
@@ -101,6 +109,7 @@ module VagrantPlugins
101
109
  @username = UNSET_VALUE
102
110
  @keypair_name = UNSET_VALUE
103
111
  @network = UNSET_VALUE
112
+ @networks = UNSET_VALUE
104
113
  @address_id = UNSET_VALUE
105
114
  @scheduler_hints = UNSET_VALUE
106
115
  @availability_zone = UNSET_VALUE
@@ -110,6 +119,7 @@ module VagrantPlugins
110
119
  @user_data = UNSET_VALUE
111
120
  @floating_ip = UNSET_VALUE
112
121
  @region = UNSET_VALUE
122
+ @proxy = UNSET_VALUE
113
123
  end
114
124
 
115
125
  def finalize!
@@ -121,6 +131,7 @@ module VagrantPlugins
121
131
  @metadata = nil if @metadata == UNSET_VALUE
122
132
  @username = nil if @username == UNSET_VALUE
123
133
  @network = nil if @network == UNSET_VALUE
134
+ @networks = nil if @networks == UNSET_VALUE
124
135
  @address_id = 'public' if @address_id == UNSET_VALUE
125
136
 
126
137
  # Keypair defaults to nil
@@ -139,6 +150,7 @@ module VagrantPlugins
139
150
  @floating_ip = nil if @floating_ip == UNSET_VALUE
140
151
 
141
152
  @region = nil if @region == UNSET_VALUE
153
+ @proxy = nil if @proxy == UNSET_VALUE
142
154
  end
143
155
 
144
156
  def validate(machine)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module OpenStack
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -22,6 +22,7 @@ describe VagrantPlugins::OpenStack::Config do
22
22
  its(:security_groups) { should be_nil }
23
23
  its(:scheduler_hints) { should be_nil }
24
24
  its(:tenant) { should be_nil }
25
+ its(:proxy) { should be_nil }
25
26
  end
26
27
 
27
28
  describe "overriding defaults" do
@@ -36,7 +37,8 @@ describe VagrantPlugins::OpenStack::Config do
36
37
  :ssh_username,
37
38
  :security_groups,
38
39
  :scheduler_hints,
39
- :tenant].each do |attribute|
40
+ :tenant,
41
+ :proxy].each do |attribute|
40
42
  it "should not default #{attribute} if overridden" do
41
43
  subject.send("#{attribute}=".to_sym, "foo")
42
44
  subject.finalize!
metadata CHANGED
@@ -1,60 +1,68 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vagrant-openstack-plugin
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Mitchell Hashimoto
8
8
  - Thomas Kadauke
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-09-25 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2014-05-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: fog
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
19
18
  - - ">="
20
- - !ruby/object:Gem::Version
19
+ - !ruby/object:Gem::Version
21
20
  version: 1.10.1
22
21
  type: :runtime
23
22
  prerelease: false
24
- version_requirements: *id001
25
- - !ruby/object:Gem::Dependency
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 1.10.1
28
+ - !ruby/object:Gem::Dependency
26
29
  name: rake
27
- requirement: &id002 !ruby/object:Gem::Requirement
28
- requirements:
29
- - &id004
30
- - ">="
31
- - !ruby/object:Gem::Version
32
- version: "0"
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
33
35
  type: :development
34
36
  prerelease: false
35
- version_requirements: *id002
36
- - !ruby/object:Gem::Dependency
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
37
43
  name: rspec
38
- requirement: &id003 !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
42
48
  version: 2.13.0
43
49
  type: :development
44
50
  prerelease: false
45
- version_requirements: *id003
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 2.13.0
46
56
  description: Enables Vagrant to manage machines in OpenStack Cloud.
47
- email:
57
+ email:
48
58
  - mitchell@hashicorp.com
49
59
  - t.kadauke@cloudbau.de
50
60
  executables: []
51
-
52
61
  extensions: []
53
-
54
62
  extra_rdoc_files: []
55
-
56
- files:
57
- - .gitignore
63
+ files:
64
+ - ".gitignore"
65
+ - ".travis.yml"
58
66
  - Authors.txt
59
67
  - CHANGELOG.md
60
68
  - Gemfile
@@ -72,9 +80,13 @@ files:
72
80
  - lib/vagrant-openstack-plugin/action/is_created.rb
73
81
  - lib/vagrant-openstack-plugin/action/message_already_created.rb
74
82
  - lib/vagrant-openstack-plugin/action/message_not_created.rb
83
+ - lib/vagrant-openstack-plugin/action/pause_server.rb
75
84
  - lib/vagrant-openstack-plugin/action/read_ssh_info.rb
76
85
  - lib/vagrant-openstack-plugin/action/read_state.rb
86
+ - lib/vagrant-openstack-plugin/action/resume_server.rb
87
+ - lib/vagrant-openstack-plugin/action/suspend_server.rb
77
88
  - lib/vagrant-openstack-plugin/action/sync_folders.rb
89
+ - lib/vagrant-openstack-plugin/action/unpause_server.rb
78
90
  - lib/vagrant-openstack-plugin/action/warn_networks.rb
79
91
  - lib/vagrant-openstack-plugin/config.rb
80
92
  - lib/vagrant-openstack-plugin/errors.rb
@@ -86,26 +98,26 @@ files:
86
98
  - vagrant-openstack-plugin.gemspec
87
99
  homepage: http://www.vagrantup.com
88
100
  licenses: []
89
-
90
101
  metadata: {}
91
-
92
102
  post_install_message:
93
103
  rdoc_options: []
94
-
95
- require_paths:
104
+ require_paths:
96
105
  - lib
97
- required_ruby_version: !ruby/object:Gem::Requirement
98
- requirements:
99
- - *id004
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- requirements:
102
- - *id004
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
103
116
  requirements: []
104
-
105
117
  rubyforge_project:
106
- rubygems_version: 2.1.3
118
+ rubygems_version: 2.2.2
107
119
  signing_key:
108
120
  specification_version: 4
109
121
  summary: Enables Vagrant to manage machines in OpenStack Cloud.
110
- test_files:
122
+ test_files:
111
123
  - spec/vagrant-openstack-plugin/config_spec.rb