Sha256: 611b1c3cd631c0f54d367c5001d1df3b40f8a3b74cf61bae29fa07f236c271f0

Contents?: true

Size: 938 Bytes

Versions: 9

Compression:

Stored size: 938 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/base')


module KnifeJoyent
  class JoyentServerResize < Chef::Knife

    include KnifeJoyent::Base

    banner 'knife joyent server resize <server_id> -f <flavor>'

    option :flavor,
      :short => "-f <flavor>",
      :long => "--flavor <flavor>",
      :description => "name of flavor/package to resize to"

    def run
      unless config[:flavor]
        show_usage
        exit 1
      end

      unless name_args.size === 1
        show_usage
        exit 1
      end

      id = name_args.first

      server = self.connection.servers.get(id)
      unless server
        puts ui.error("Server with id: #{id} not found")
        exit 1
      end

      if self.connection.resize_machine(id, config[:flavor])
        puts ui.color("Resized server #{id}", :cyan)
        exit 0
      else
        puts ui.error("Resize server failed")
        exit 1
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knife-joyent-0.0.10 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.9 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.7 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.6 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.5 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.4 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.3 lib/chef/knife/joyent_server_resize.rb
knife-joyent-0.0.2 lib/knife-joyent/joyent_server_resize.rb
knife-joyent-0.0.1 lib/knife-joyent/joyent_server_resize.rb