Sha256: d40bbe2304555bbb5e6b101020021ba5a0077433ad0c02dac58ff61ca28a9631

Contents?: true

Size: 1.64 KB

Versions: 17

Compression:

Stored size: 1.64 KB

Contents

#
# Author:: Christo De Lange <opscode@dldinternet.com>
# Monkey patch for Chef::Knife::RoleFromFile
#
require 'chef/knife/role_from_file'

class ::Chef::Knife::RoleFromFile
  # --------------------------------------------------------------------------------------------------------------------
  # Create a new instance of the current class configured for the given
  # arguments and options
  def initialize(argv=[])
    super(argv)
    @rsrctype = 'role'
    @location = 'roles'
  end

  def run
    @name_args.each do |arg|
      updated = loader.load_from("roles", arg)

      updated.save

      output(format_for_display(updated)) if config[:print_after]

      ui.info("Updated Role #{updated.name}!")
    end
  end

  # --------------------------------------------------------------------------------------------------------------------
  private
  # --------------------------------------------------------------------------------------------------------------------

  # --------------------------------------------------------------------------------------------------------------------
  def translate_all_roles
    roles = find_all_roles
    if roles.empty?
      ui.fatal("Unable to find any role files in '#{roles_path}'")
      exit(1)
    end
    roles.each do |env|
      translate_role(env)
    end
  end

  # --------------------------------------------------------------------------------------------------------------------
  def translate_role(env)
    updated = loader.load_from("roles", env)
    updated.translate(@config,env)
    output(format_for_display(updated)) if config[:print_after]
    ui.info("Translated Role #{updated.name}")
  end

end





Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
knife-chop-0.12.18 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.12.17 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.12.03 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.11.12 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.9.5 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.9.4 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.9.2 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.9.1 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.9.0 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.8.3 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.8.2 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.8.0 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.7.8 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.7.2 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.7.1 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.7.0 lib/chef/knife/chop/role_from_file.rb
knife-chop-0.6.7 lib/chef/knife/chop/role_from_file.rb