Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subnetwork support #166

Merged
merged 5 commits into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/vagrant-google/action/run_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
disk_name = zone_config.disk_name
disk_type = zone_config.disk_type
network = zone_config.network
subnetwork = zone_config.subnetwork
metadata = zone_config.metadata
tags = zone_config.tags
can_ip_forward = zone_config.can_ip_forward
Expand All @@ -72,6 +73,7 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
env[:ui].info(" -- Instance Group: #{instance_group}")
env[:ui].info(" -- Zone: #{zone}") if zone
env[:ui].info(" -- Network: #{network}") if network
env[:ui].info(" -- Subnetwork: #{subnetwork}") if subnetwork
env[:ui].info(" -- Metadata: '#{metadata}'")
env[:ui].info(" -- Tags: '#{tags}'")
env[:ui].info(" -- IP Forward: #{can_ip_forward}")
Expand Down Expand Up @@ -126,6 +128,7 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
:disk_type => disk_type,
:image => image,
:network => network,
:subnetwork => subnetwork,
:metadata => metadata,
:tags => tags,
:can_ip_forward => can_ip_forward,
Expand Down
9 changes: 9 additions & 0 deletions lib/vagrant-google/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ class Config < Vagrant.plugin("2", :config) # rubocop:disable Metrics/ClassLengt
# @return [String]
attr_accessor :network

# The name of the subnetwork
#
# @return [String]
attr_accessor :subnetwork

# Tags to apply to the instance
#
# @return [Array]
Expand Down Expand Up @@ -159,6 +164,7 @@ def initialize(zone_specific=false)
@metadata = {}
@name = UNSET_VALUE
@network = UNSET_VALUE
@subnetwork = UNSET_VALUE
@tags = []
@can_ip_forward = UNSET_VALUE
@external_ip = UNSET_VALUE
Expand Down Expand Up @@ -275,6 +281,9 @@ def finalize! # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedC
# Network defaults to 'default'
@network = "default" if @network == UNSET_VALUE

# Subnetwork defaults to nil
@subnetwork = nil if @subnetwork == UNSET_VALUE

# Default zone is us-central1-f.
@zone = "us-central1-f" if @zone == UNSET_VALUE

Expand Down
4 changes: 2 additions & 2 deletions vagrant-google.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "vagrant-google"

s.add_runtime_dependency "fog-google", "~> 0.4.0"
s.add_runtime_dependency "google-api-client", "< 0.9", ">= 0.6.2"
s.add_runtime_dependency "fog-google", "~> 0.5.3"
s.add_runtime_dependency "google-api-client", "< 0.9", "> 0.8.5"

s.add_development_dependency "pry"
s.add_development_dependency "pry-byebug"
Expand Down