Sha256: bf053c4d20141ac1150439943c386c5d96f4878efb3fe462daf6c50b128aa74f

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

require 'chef/knife'
require 'knife-spork/runner'

module KnifeSpork
  class SporkRoleDelete < Chef::Knife
    include KnifeSpork::Runner

    banner 'knife spork role delete ROLENAME (options)'

    def run
      self.config = Chef::Config.merge!(config)

      if @name_args.empty?
        show_usage
        ui.error("You must specify a role name")
        exit 1
      end

      @object_name = @name_args.first

      run_plugins(:before_roledelete)
      pre_role = load_role(@object_name)
      role_delete
      post_role = {}
      @object_difference = json_diff(pre_role,post_role).to_s
      run_plugins(:after_roledelete)
    end

    private
    def role_delete
      rd = Chef::Knife::RoleDelete.new
      rd.name_args = @name_args
      rd.run
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
knife-spork-berks-1.3.2 lib/chef/knife/spork-role-delete.rb
knife-spork-1.3.2 lib/chef/knife/spork-role-delete.rb