/chef/lib/chef/knife/role_edit.rb

http://github.com/opscode/chef · Ruby · 48 lines · 21 code · 10 blank · 17 comment · 1 complexity · 82d2cfb2539c2cdcde5eb1ef323de8ed MD5 · raw file

  1. #
  2. # Author:: Adam Jacob (<adam@opscode.com>)
  3. # Copyright:: Copyright (c) 2009 Opscode, Inc.
  4. # License:: Apache License, Version 2.0
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. require 'chef/knife'
  19. class Chef
  20. class Knife
  21. class RoleEdit < Knife
  22. deps do
  23. require 'chef/role'
  24. require 'chef/json_compat'
  25. end
  26. banner "knife role edit ROLE (options)"
  27. def run
  28. @role_name = @name_args[0]
  29. if @role_name.nil?
  30. show_usage
  31. ui.fatal("You must specify a role name")
  32. exit 1
  33. end
  34. ui.edit_object(Chef::Role, @role_name)
  35. end
  36. end
  37. end
  38. end