Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #33 from rackspace/disk_config
Browse files Browse the repository at this point in the history
adding ability to specify disk_config in knife configuration file.
  • Loading branch information
Kyle Rames committed Sep 5, 2013
2 parents 06318ce + 8f285f9 commit 03acd1e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ vagrant will authenticate against the UK authentication endpoint.
defaults to the name of the Vagrant machine (via `config.vm.define`), but
can be overridden with this.
* `username` - The username with which to access Rackspace.
* `disk_config` - Disk Configuration 'AUTO' or 'MANUAL'

These can be set like typical provider-specific configuration:

Expand Down
2 changes: 2 additions & 0 deletions lib/vagrant-rackspace/action/create_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def call(env)
env[:ui].info(I18n.t("vagrant_rackspace.launching_server"))
env[:ui].info(" -- Flavor: #{flavor.name}")
env[:ui].info(" -- Image: #{image.name}")
env[:ui].info(" -- Disk Config: #{config.disk_config}") if config.disk_config
env[:ui].info(" -- Name: #{server_name}")

# Build the options for launching...
Expand All @@ -58,6 +59,7 @@ def call(env)
}
]
}
options[:disk_config] = config.disk_config if config.disk_config

# Create the server
server = env[:rackspace_compute].servers.create(options)
Expand Down
14 changes: 14 additions & 0 deletions lib/vagrant-rackspace/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ class Config < Vagrant.plugin("2", :config)
# @return [String]
attr_accessor :username

# The disk configuration value.
# * AUTO - The server is built with a single partition the size of the target flavor disk. The file system is automatically adjusted to fit the entire partition.
# This keeps things simple and automated. AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
# This is the default setting for applicable Rackspace base images.
#
# * MANUAL - The server is built using whatever partition scheme and file system is in the source image. If the target flavor disk is larger,
# the remaining disk space is left unpartitioned. This enables images to have non-EXT3 file systems, multiple partitions,
# and so on, and enables you to manage the disk configuration.
#
# This defaults to MANUAL
attr_accessor :disk_config

def initialize
@api_key = UNSET_VALUE
@rackspace_region = UNSET_VALUE
Expand All @@ -80,6 +92,7 @@ def initialize
@rackconnect = UNSET_VALUE
@server_name = UNSET_VALUE
@username = UNSET_VALUE
@disk_config = UNSET_VALUE
end

def finalize!
Expand All @@ -92,6 +105,7 @@ def finalize!
@rackconnect = nil if @rackconnect == UNSET_VALUE
@server_name = nil if @server_name == UNSET_VALUE
@username = nil if @username == UNSET_VALUE
@disk_config = nil if @disk_config == UNSET_VALUE

if @public_key_path == UNSET_VALUE
@public_key_path = Vagrant.source_root.join("keys/vagrant.pub")
Expand Down
2 changes: 2 additions & 0 deletions spec/vagrant-rackspace/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
its(:rackconnect) { should be_nil }
its(:server_name) { should be_nil }
its(:username) { should be_nil }
its(:disk_config) { should be_nil }
end

describe "overriding defaults" do
Expand All @@ -33,6 +34,7 @@
:public_key_path,
:rackconnect,
:server_name,
:disk_config,
:username].each do |attribute|
it "should not default #{attribute} if overridden" do
subject.send("#{attribute}=".to_sym, "foo")
Expand Down

0 comments on commit 03acd1e

Please sign in to comment.