chef-dk 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/lib/chef-dk/builtin_commands.rb +7 -0
  4. data/lib/chef-dk/command/env.rb +90 -0
  5. data/lib/chef-dk/command/export.rb +22 -1
  6. data/lib/chef-dk/command/generate.rb +1 -1
  7. data/lib/chef-dk/command/provision.rb +43 -0
  8. data/lib/chef-dk/command/push_archive.rb +126 -0
  9. data/lib/chef-dk/command/show_policy.rb +166 -0
  10. data/lib/chef-dk/command/verify.rb +58 -1
  11. data/lib/chef-dk/cookbook_omnifetch.rb +3 -2
  12. data/lib/chef-dk/exceptions.rb +27 -0
  13. data/lib/chef-dk/helpers.rb +29 -0
  14. data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +8 -0
  15. data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +8 -0
  16. data/lib/chef-dk/policyfile/community_cookbook_source.rb +8 -0
  17. data/lib/chef-dk/policyfile/cookbook_locks.rb +76 -6
  18. data/lib/chef-dk/policyfile/dsl.rb +10 -5
  19. data/lib/chef-dk/policyfile/lister.rb +230 -0
  20. data/lib/chef-dk/policyfile/null_cookbook_source.rb +8 -0
  21. data/lib/chef-dk/policyfile_compiler.rb +35 -2
  22. data/lib/chef-dk/policyfile_lock.rb +43 -0
  23. data/lib/chef-dk/policyfile_services/clean_policies.rb +94 -0
  24. data/lib/chef-dk/policyfile_services/export_repo.rb +103 -16
  25. data/lib/chef-dk/policyfile_services/push_archive.rb +173 -0
  26. data/lib/chef-dk/policyfile_services/show_policy.rb +237 -0
  27. data/lib/chef-dk/service_exceptions.rb +21 -0
  28. data/lib/chef-dk/skeletons/code_generator/files/default/chefignore +1 -0
  29. data/lib/chef-dk/skeletons/code_generator/files/default/repo/README.md +2 -40
  30. data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +0 -2
  31. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +2 -2
  32. data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +1 -1
  33. data/lib/chef-dk/version.rb +1 -1
  34. data/spec/unit/command/env_spec.rb +52 -0
  35. data/spec/unit/command/exec_spec.rb +2 -2
  36. data/spec/unit/command/export_spec.rb +13 -0
  37. data/spec/unit/command/provision_spec.rb +56 -0
  38. data/spec/unit/command/push_archive_spec.rb +153 -0
  39. data/spec/unit/command/show_policy_spec.rb +235 -0
  40. data/spec/unit/command/verify_spec.rb +1 -0
  41. data/spec/unit/helpers_spec.rb +68 -0
  42. data/spec/unit/policyfile/cookbook_locks_spec.rb +107 -1
  43. data/spec/unit/policyfile/lister_spec.rb +256 -0
  44. data/spec/unit/policyfile_demands_spec.rb +202 -10
  45. data/spec/unit/policyfile_evaluation_spec.rb +30 -4
  46. data/spec/unit/policyfile_lock_serialization_spec.rb +45 -0
  47. data/spec/unit/policyfile_services/clean_policies_spec.rb +236 -0
  48. data/spec/unit/policyfile_services/export_repo_spec.rb +99 -6
  49. data/spec/unit/policyfile_services/push_archive_spec.rb +345 -0
  50. data/spec/unit/policyfile_services/show_policy_spec.rb +839 -0
  51. metadata +139 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 860c091ba42d4860904fc388511cf64813b1d77f
4
- data.tar.gz: 7499f52d7e0f394607436c2cdb66ecfb578183fa
3
+ metadata.gz: ee32c7f8bf0ecdab62b80de5ea8a4464b51c6838
4
+ data.tar.gz: 2e111a49b664088c4111f0b66fd07b17ed0c5eaa
5
5
  SHA512:
6
- metadata.gz: e4ad98327039f2edee2b6ea3c57c7ee8797060831480ef34b8202ec16ffc2beeb95215188c813af32002f0ba7235835842cdbb1b142d954324380e77a513b6dc
7
- data.tar.gz: 0ab0237034a7edaeb6b6ee38274d195c492e2f268acc078fe87547c1a8d0349aeee0717c8708f1a3879eaaf0bf60808901a998ea8184e68643c50fb82352e60f
6
+ metadata.gz: ebe65296faf1e24202b4f577422a0956feb1feb722d623b9c74b9894f64d43afc55aac6fdd87ea3e659c2be85fa97a80af44b05a5e7866d1d5deaed2f2ead062
7
+ data.tar.gz: 713d6cca6c4fc3cc510e6f402bee5a8c81e7df06cf8be0423e911267b8419df6c6568f6e7b348f54959ff27f997acd44b0b824700653f3335c99c2ba5c86390e
data/README.md CHANGED
@@ -23,6 +23,10 @@ Once you install the package, the `chef-client` suite, `berks`,
23
23
  `kitchen`, and this application (`chef`) will be symlinked into your
24
24
  system bin directory, ready to use.
25
25
 
26
+ ### Pre-release Candiates
27
+
28
+ You can run `curl -LO https://www.chef.io/chef/install.sh && sudo bash ./install.sh -P chefdk -p && rm install.sh` to download and install the latest pre-release candidate. If you want to specify a different version replace `-p` with `-v <version>`
29
+
26
30
  ## Usage
27
31
 
28
32
  For help with [Berkshelf][], [Test Kitchen][], [ChefSpec][] or [Foodcritic][],
@@ -20,6 +20,9 @@ ChefDK.commands do |c|
20
20
  c.builtin "exec", :Exec, require_path: "chef-dk/command/exec",
21
21
  desc: "Runs the command in context of the embedded ruby"
22
22
 
23
+ c.builtin "env", :Env, require_path: "chef-dk/command/env",
24
+ desc: "Prints environment variables used by ChefDK"
25
+
23
26
  c.builtin "gem", :GemForwarder, require_path: "chef-dk/command/gem",
24
27
  desc: "Runs the `gem` command in context of the embedded ruby"
25
28
 
@@ -33,6 +36,10 @@ ChefDK.commands do |c|
33
36
 
34
37
  c.builtin "push", :Push, desc: "Push a local policy lock to a policy group on the server"
35
38
 
39
+ c.builtin "push-archive", :PushArchive, desc: "Push a policy archive to a policy group on the server"
40
+
41
+ c.builtin "show-policy", :ShowPolicy, desc: "Show policyfile objects on you Chef Server"
42
+
36
43
  c.builtin "diff", :Diff, desc: "Generate an itemized diff of two Policyfile lock documents"
37
44
 
38
45
  c.builtin "provision", :Provision, desc: "Provision VMs and clusters via cookbook"
@@ -0,0 +1,90 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2015 Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'chef-dk/command/base'
19
+ require 'chef-dk/cookbook_omnifetch'
20
+ require 'chef-dk/ui'
21
+ require 'chef-dk/version'
22
+ require 'mixlib/shellout'
23
+ require 'yaml'
24
+
25
+ module ChefDK
26
+ module Command
27
+ class Env < ChefDK::Command::Base
28
+ banner "Usage: chef env"
29
+
30
+ attr_accessor :ui
31
+
32
+ def initialize(*args)
33
+ super
34
+ @ui = UI.new
35
+ end
36
+
37
+ def run(params)
38
+ info = {}
39
+ info['Chef Development Kit'] = Hash.new.tap do |chefdk_env|
40
+ chefdk_env['ChefDK'] = chefdk_info
41
+ chefdk_env['Ruby'] = ruby_info
42
+ chefdk_env['Path'] = paths
43
+ end
44
+ ui.msg info.to_yaml
45
+ end
46
+
47
+ def chefdk_info
48
+ Hash.new.tap do |chefdk|
49
+ chefdk['ChefDK Version'] = ChefDK::VERSION
50
+ chefdk['ChefDK Home'] = chefdk_home
51
+ chefdk['ChefDK Install Directory'] = omnibus_root
52
+ chefdk['Policyfile Config'] = policyfile_config
53
+ end
54
+ end
55
+
56
+ def ruby_info
57
+ Hash.new.tap do |ruby|
58
+ ruby['Ruby Executable'] = Gem.ruby
59
+ ruby['Ruby Version'] = RUBY_VERSION
60
+ ruby['RubyGems'] = Hash.new.tap do |rubygems|
61
+ rubygems['RubyGems Version'] = Gem::VERSION
62
+ rubygems['RubyGems Platforms'] = Gem.platforms.map(&:to_s)
63
+ rubygems['Gem Environment'] = gem_environment
64
+ end
65
+ end
66
+ end
67
+
68
+ def gem_environment
69
+ Hash.new.tap do |h|
70
+ h['GEM ROOT'] = omnibus_env['GEM_ROOT']
71
+ h['GEM HOME'] = omnibus_env['GEM_HOME']
72
+ h['GEM PATHS'] = omnibus_env['GEM_PATH'].split(File::PATH_SEPARATOR)
73
+ end
74
+ end
75
+
76
+ def paths
77
+ omnibus_env['PATH'].split(File::PATH_SEPARATOR)
78
+ end
79
+
80
+ def policyfile_config
81
+ Hash.new.tap do |h|
82
+ h['Cache Path'] = CookbookOmnifetch.cache_path
83
+ h['Storage Path'] = CookbookOmnifetch.storage_path.to_s
84
+ end
85
+ end
86
+
87
+ end
88
+ end
89
+ end
90
+
@@ -38,6 +38,7 @@ to the target machine, you can apply the policy to the machine with
38
38
  use_policyfile true
39
39
  deployment_group '$POLICY_NAME-local'
40
40
  versioned_cookbooks true
41
+ policy_document_native_api false
41
42
 
42
43
  The Policyfile feature is incomplete and beta quality. See our detailed README
43
44
  for more information.
@@ -48,6 +49,13 @@ Options:
48
49
 
49
50
  E
50
51
 
52
+ option :archive,
53
+ short: "-a",
54
+ long: "--archive",
55
+ description: "Export as a tarball archive rather than a directory",
56
+ default: false,
57
+ boolean: true
58
+
51
59
  option :force,
52
60
  short: "-f",
53
61
  long: "--force",
@@ -79,7 +87,7 @@ E
79
87
  def run(params = [])
80
88
  return 1 unless apply_params!(params)
81
89
  export_service.run
82
- ui.msg("Exported policy '#{export_service.policyfile_lock.name}' to #{export_dir}")
90
+ ui.msg("Exported policy '#{export_service.policyfile_lock.name}' to #{export_target}")
83
91
  0
84
92
  rescue ExportDirNotEmpty => e
85
93
  ui.err("ERROR: " + e.message)
@@ -90,14 +98,27 @@ E
90
98
  1
91
99
  end
92
100
 
101
+ def export_target
102
+ if archive?
103
+ export_service.archive_file_location
104
+ else
105
+ export_dir
106
+ end
107
+ end
108
+
93
109
  def debug?
94
110
  !!config[:debug]
95
111
  end
96
112
 
113
+ def archive?
114
+ !!config[:archive]
115
+ end
116
+
97
117
  def export_service
98
118
  @export_service ||= PolicyfileServices::ExportRepo.new(policyfile: policyfile_relative_path,
99
119
  export_dir: export_dir,
100
120
  root_dir: Dir.pwd,
121
+ archive: archive?,
101
122
  force: config[:force])
102
123
  end
103
124
 
@@ -50,7 +50,7 @@ module ChefDK
50
50
  generator(:template, :Template, "Generate a file template")
51
51
  generator(:file, :CookbookFile, "Generate a cookbook file")
52
52
  generator(:lwrp, :LWRP, "Generate a lightweight resource/provider")
53
- generator(:repo, :Repo, "Generate a Chef policy repository")
53
+ generator(:repo, :Repo, "Generate a Chef code repository")
54
54
  generator(:policyfile, :Policyfile, "Generate a Policyfile for use with the install/push commands (experimental)")
55
55
 
56
56
  def self.banner_headline
@@ -15,6 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
+ require 'ostruct'
19
+
18
20
  require 'chef-dk/command/base'
19
21
  require 'chef-dk/configurable'
20
22
  require 'chef-dk/chef_runner'
@@ -40,6 +42,8 @@ module ChefDK
40
42
 
41
43
  attr_accessor :node_name
42
44
 
45
+ attr_accessor :target
46
+
43
47
  attr_accessor :enable_policyfile
44
48
 
45
49
  attr_accessor :policy_group
@@ -48,8 +52,15 @@ module ChefDK
48
52
 
49
53
  attr_accessor :extra_chef_config
50
54
 
55
+ attr_accessor :opts
56
+
51
57
  def initialize
52
58
  @extra_chef_config = ""
59
+ @opts = nil
60
+ end
61
+
62
+ def set_user_opts(hash)
63
+ @opts = OpenStruct.new(hash)
53
64
  end
54
65
 
55
66
  def convergence_options
@@ -173,6 +184,27 @@ E
173
184
  long: "--node-name NODE_NAME",
174
185
  description: "Set default node name (may be overriden by provisioning cookbook)"
175
186
 
187
+ option :target,
188
+ short: "-t REMOTE_HOST",
189
+ long: "--target REMOTE_HOST",
190
+ description: "Set hostname or IP of the host to converge (may be overriden by provisioning cookbook)"
191
+
192
+ OPT_SEPARATOR = /[=\s]+/.freeze
193
+
194
+ def self.split_opt(key_value)
195
+ key, _separator, value = key_value.partition(OPT_SEPARATOR)
196
+ [key, value]
197
+ end
198
+
199
+ opts={}
200
+
201
+ option :opts,
202
+ short: "-o OPT=VALUE",
203
+ long: "--opt OPT=VALUE",
204
+ description: "Set arbitrary option OPT on the provisioning context",
205
+ proc: lambda { |arg| key, value = split_opt(arg); opts[key] = value; opts },
206
+ default: {}
207
+
176
208
  option :debug,
177
209
  short: "-D",
178
210
  long: "--debug",
@@ -238,6 +270,9 @@ E
238
270
 
239
271
  c.action = default_action
240
272
  c.node_name = node_name
273
+ c.target = target
274
+
275
+ c.set_user_opts(user_opts)
241
276
 
242
277
  c.enable_policyfile = enable_policyfile?
243
278
 
@@ -269,6 +304,14 @@ E
269
304
  config[:node_name]
270
305
  end
271
306
 
307
+ def target
308
+ config[:target]
309
+ end
310
+
311
+ def user_opts
312
+ config[:opts]
313
+ end
314
+
272
315
  def recipe
273
316
  config[:machine_recipe]
274
317
  end
@@ -0,0 +1,126 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2015 Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'chef-dk/command/base'
19
+ require 'chef-dk/ui'
20
+ require 'chef-dk/policyfile_services/push_archive'
21
+ require 'chef-dk/configurable'
22
+
23
+ module ChefDK
24
+ module Command
25
+
26
+ class PushArchive < Base
27
+
28
+ include Configurable
29
+
30
+ banner(<<-E)
31
+ Usage: chef push-archive POLICY_GROUP ARCHIVE_FILE [options]
32
+
33
+ `chef push-archive` publishes a policy archive to a Chef Server. Policy
34
+ archives can be created with `chef export -a`. The policy will be applied to
35
+ the given POLICY_GROUP, which is a set of nodes that share the same
36
+ run_list and cookbooks.
37
+
38
+ For more information about Policyfiles, see our detailed README:
39
+
40
+ https://github.com/opscode/chef-dk/blob/master/POLICYFILE_README.md
41
+
42
+ Options:
43
+ E
44
+
45
+ option :config_file,
46
+ short: "-c CONFIG_FILE",
47
+ long: "--config CONFIG_FILE",
48
+ description: "Path to configuration file"
49
+
50
+ option :debug,
51
+ short: "-D",
52
+ long: "--debug",
53
+ description: "Enable stacktraces and other debug output",
54
+ default: false
55
+
56
+ attr_accessor :ui
57
+
58
+ attr_reader :policy_group
59
+
60
+ attr_reader :archive_path
61
+
62
+ def initialize(*args)
63
+ super
64
+ @policy_group = nil
65
+ @archive_path = nil
66
+ @chef_config = nil
67
+ @ui = UI.new
68
+ end
69
+
70
+ def run(params)
71
+ return 1 unless apply_params!(params)
72
+
73
+ push_archive_service.run
74
+
75
+ 0
76
+ rescue PolicyfileServiceError => e
77
+ handle_error(e)
78
+ 1
79
+ end
80
+
81
+ # @api private
82
+ def handle_error(error)
83
+ ui.err("Error: #{error.message}")
84
+ if error.respond_to?(:reason)
85
+ ui.err("Reason: #{error.reason}")
86
+ ui.err("")
87
+ ui.err(error.extended_error_info) if debug?
88
+ ui.err(error.cause.backtrace.join("\n")) if debug?
89
+ end
90
+ end
91
+
92
+ # @api private
93
+ def push_archive_service
94
+ @push_archive_service ||=
95
+ ChefDK::PolicyfileServices::PushArchive.new(
96
+ archive_file: archive_file,
97
+ policy_group: policy_group,
98
+ ui: ui,
99
+ config: chef_config
100
+ )
101
+ end
102
+
103
+ def archive_file
104
+ File.expand_path(archive_path)
105
+ end
106
+
107
+ # @api private
108
+ def debug?
109
+ !!config[:debug]
110
+ end
111
+
112
+ # @api private
113
+ def apply_params!(params)
114
+ remaining_args = parse_options(params)
115
+ if remaining_args.size != 2
116
+ ui.err(opt_parser)
117
+ return false
118
+ end
119
+
120
+ @policy_group, @archive_path = remaining_args
121
+ end
122
+
123
+ end
124
+ end
125
+ end
126
+
@@ -0,0 +1,166 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2015 Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'chef-dk/command/base'
19
+ require 'chef-dk/ui'
20
+ require 'chef-dk/configurable'
21
+ require 'chef-dk/policyfile/lister'
22
+ require 'chef-dk/policyfile_services/show_policy'
23
+
24
+ module ChefDK
25
+ module Command
26
+
27
+
28
+ class ShowPolicy < Base
29
+
30
+ banner(<<-BANNER)
31
+ Usage: chef show-policy [POLICY_NAME [POLICY_GROUP]] [options]
32
+
33
+ `chef show-policy` Displays the revisions of policyfiles on the server. By
34
+ default, only active policy revisions are shown. Use the `--orphans` options to
35
+ show policy revisions that are not assigned to any policy group.
36
+
37
+ When both POLICY_NAME and POLICY_GROUP are given, the command shows the content
38
+ of a the active policyfile lock for the given POLICY_GROUP. See also the `diff`
39
+ command.
40
+
41
+ The Policyfile feature is incomplete and beta quality. See our detailed README
42
+ for more information.
43
+
44
+ https://github.com/opscode/chef-dk/blob/master/POLICYFILE_README.md
45
+
46
+ Options:
47
+
48
+ BANNER
49
+
50
+ option :show_orphans,
51
+ short: "-o",
52
+ long: "--orphans",
53
+ description: "Show policy revisions that are unassigned",
54
+ default: false
55
+
56
+ option :pager,
57
+ long: "--[no-]pager",
58
+ description: "Enable/disable paged policyfile lock ouput (default: enabled)",
59
+ default: true,
60
+ boolean: true
61
+
62
+ option :config_file,
63
+ short: "-c CONFIG_FILE",
64
+ long: "--config CONFIG_FILE",
65
+ description: "Path to configuration file"
66
+
67
+ option :debug,
68
+ short: "-D",
69
+ long: "--debug",
70
+ description: "Enable stacktraces and other debug output",
71
+ default: false
72
+
73
+ include Configurable
74
+
75
+ attr_accessor :ui
76
+
77
+ attr_reader :policy_name
78
+
79
+ attr_reader :policy_group
80
+
81
+ def initialize(*args)
82
+ super
83
+ @show_all_policies = nil
84
+ @policy_name = nil
85
+ @policy_group = nil
86
+ @ui = UI.new
87
+ end
88
+
89
+ def run(params)
90
+ return 1 unless apply_params!(params)
91
+ show_policy_service.run
92
+ 0
93
+ rescue PolicyfileServiceError => e
94
+ handle_error(e)
95
+ 1
96
+ end
97
+
98
+ def show_policy_service
99
+ @policy_list_service ||=
100
+ PolicyfileServices::ShowPolicy.new(config: chef_config,
101
+ ui: ui,
102
+ policy_name: policy_name,
103
+ policy_group: policy_group,
104
+ show_orphans: show_orphans?,
105
+ summary_diff: show_summary_diff?,
106
+ pager: enable_pager?)
107
+ end
108
+
109
+ def debug?
110
+ !!config[:debug]
111
+ end
112
+
113
+ def show_summary_diff?
114
+ false
115
+ end
116
+
117
+ def show_orphans?
118
+ config[:show_orphans]
119
+ end
120
+
121
+ def enable_pager?
122
+ config[:pager]
123
+ end
124
+
125
+ def handle_error(error)
126
+ ui.err("Error: #{error.message}")
127
+ if error.respond_to?(:reason)
128
+ ui.err("Reason: #{error.reason}")
129
+ ui.err("")
130
+ ui.err(error.extended_error_info) if debug?
131
+ ui.err(error.cause.backtrace.join("\n")) if debug?
132
+ end
133
+ end
134
+
135
+ def apply_params!(params)
136
+ remaining_args = parse_options(params)
137
+
138
+ if remaining_args.empty? && show_summary_diff?
139
+ ui.err("The --summary-diff option can only be used when showing a single policy")
140
+ ui.err("")
141
+ ui.err(opt_parser)
142
+ false
143
+ elsif remaining_args.empty?
144
+ @show_all_policies = true
145
+ true
146
+ elsif remaining_args.size == 1
147
+ @policy_name = remaining_args.first
148
+ @show_all_policies = false
149
+ true
150
+ elsif remaining_args.size == 2
151
+ @policy_name = remaining_args[0]
152
+ @policy_group = remaining_args[1]
153
+ @show_all_policies = false
154
+ true
155
+ else
156
+ ui.err("Too many arguments")
157
+ ui.err("")
158
+ ui.err(opt_parser)
159
+ false
160
+ end
161
+ end
162
+
163
+ end
164
+ end
165
+ end
166
+