# class Chef::Knife::TagCreate

### Public Instance Methods

run() click to toggle source

    # File lib/chef/knife/tag_create.rb, line 33
    def run
      name = @name_args[0]
      tags = @name_args[1..-1]

      if name.nil? || tags.nil? || tags.empty?
        show_usage
        ui.fatal("You must specify a node name and at least one tag.")
        exit 1
      end

      node = Chef::Node.load name
      tags.each do |tag|
        (node.tags << tag).uniq!
      end
      node.save
      ui.info("Created tags #{tags.join(", ")} for node #{name}.")
    end