Sha256: 82b557fb68527a3358c0445bb9c549c8bfbf87f6eea87cf19074df4a04ef4210

Contents?: true

Size: 841 Bytes

Versions: 11

Compression:

Stored size: 841 Bytes

Contents

require 'chef/knife/joyent_base'

class Chef
  class Knife
    class JoyentServerStop < Knife

      include Knife::JoyentBase

      banner 'knife joyent server stop <server_id>'

      def run
        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("Unable to locate server: #{id}")
          exit 1
        end

        if server.stopped?
          puts ui.error("Server #{id} is already stopped")
          exit 1
        end

        if server.stop
          puts ui.color("Stopped server: #{id}", :cyan)
          exit 0
        else
          puts ui.error("Failed to stop server")
          exit 1
        end
      end
    rescue => e
      output_error(e)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
knife-joyent-0.4.14 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.12 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.11 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.10 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.9 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.8 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.5 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.4 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.3 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.2 lib/chef/knife/joyent_server_stop.rb
knife-joyent-0.4.1 lib/chef/knife/joyent_server_stop.rb