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