Sha256: ac064b553c28760ffb66fe2abada8ba2843efb5c8def9b4add597b8d8aa3ced3

Contents?: true

Size: 875 Bytes

Versions: 14

Compression:

Stored size: 875 Bytes

Contents

require 'chef/knife'

module KnifeSpork
  class SporkRoleEdit < Chef::Knife

    deps do
      require 'knife-spork/runner'
    end

    banner 'knife spork role edit ROLENAME (options)'

    def run
      self.class.send(:include, KnifeSpork::Runner)
      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_roleedit)
      pre_role = load_role(@object_name)
      role_edit
      post_role = load_role(@object_name)
      @object_difference = json_diff(pre_role,post_role).to_s
      run_plugins(:after_roleedit)
    end

    private
    def role_edit
      re = Chef::Knife::RoleEdit.new
      re.name_args = @name_args
      re.config[:editor] = config[:editor]
      re.run
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
knife-spork-1.7.2 lib/chef/knife/spork-role-edit.rb
knife-spork-1.7.1 lib/chef/knife/spork-role-edit.rb
knife-spork-1.7.0 lib/chef/knife/spork-role-edit.rb
knife-spork-1.6.3 lib/chef/knife/spork-role-edit.rb
knife-spork-1.6.2 lib/chef/knife/spork-role-edit.rb
knife-spork-1.6.1 lib/chef/knife/spork-role-edit.rb
knife-spork-1.6.0 lib/chef/knife/spork-role-edit.rb
knife-spork-1.5.1 lib/chef/knife/spork-role-edit.rb
knife-spork-1.5.0 lib/chef/knife/spork-role-edit.rb
knife-spork-1.4.2 lib/chef/knife/spork-role-edit.rb
knife-spork-1.4.1 lib/chef/knife/spork-role-edit.rb
knife-spork-1.4.0 lib/chef/knife/spork-role-edit.rb
knife-spork-1.3.4 lib/chef/knife/spork-role-edit.rb
knife-spork-1.3.3 lib/chef/knife/spork-role-edit.rb