Sha256: 798c971dfe1971eb6497d94ca39eaa027bb0e297919b0fcf470285c0d06e5a25

Contents?: true

Size: 850 Bytes

Versions: 11

Compression:

Stored size: 850 Bytes

Contents

require 'chef/knife/joyent_base'

class Chef
  class Knife
    class JoyentTagCreate < Knife

      include Knife::JoyentBase

      banner "knife joyent tag create <server_id> <tag> <value>"

      def run
        server = name_args[0]
        tagkey = name_args[1]
        tagvalue = name_args[2]

        unless server || tagkey || tagvalue
          show_usage
          exit 1
        end

        tags = [
          ui.color('Name', :bold),
          ui.color('Value', :bold),
        ]

        self.connection.servers.get(server).add_tags({tagkey => tagvalue}).each do |k, v|
          tags << k
          tags << v
        end

        puts ui.color("Updated tags for #{server}", :cyan)
        puts ui.list(tags, :uneven_columns_across, 2)
        exit 0
      rescue => e
        output_error(e)
        exit 1
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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