diff options
author | tylercloke <tylercloke@gmail.com> | 2015-04-28 18:25:54 -0700 |
---|---|---|
committer | tylercloke <tylercloke@gmail.com> | 2015-04-29 10:14:17 -0700 |
commit | 9850147d638bae25d4fc2e1166e486d807ecdd9f (patch) | |
tree | 3143b320046ba8eca2de5099c82a2800f21b1df6 /lib/chef/knife/key_list_base.rb | |
parent | 8385125e5bf3bd4139f75c7f4d5d2cb030ebaa98 (diff) | |
download | chef-9850147d638bae25d4fc2e1166e486d807ecdd9f.tar.gz |
Implemented `knife user key list` and `knife client key list`.tc/key-list
Abstracted out a bunch of common tests with the key create code to reduce redundancy.
Diffstat (limited to 'lib/chef/knife/key_list_base.rb')
-rw-r--r-- | lib/chef/knife/key_list_base.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/chef/knife/key_list_base.rb b/lib/chef/knife/key_list_base.rb new file mode 100644 index 0000000000..861db0d75a --- /dev/null +++ b/lib/chef/knife/key_list_base.rb @@ -0,0 +1,45 @@ +# +# Author:: Tyler Cloke (<tyler@chef.io>) +# Copyright:: Copyright (c) 2015 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class Chef + class Knife + # Extendable module that class_eval's common options into UserKeyList and ClientKeyList + # + # @author Tyler Cloke + module KeyListBase + def self.included(includer) + includer.class_eval do + option :with_details, + :short => "-w", + :long => "--with-details", + :description => "Show corresponding URIs and whether the key has expired or not." + + option :only_expired, + :short => "-e", + :long => "--only-expired", + :description => "Only show expired keys." + + option :only_non_expired, + :short => "-n", + :long => "--only-non-expired", + :description => "Only show non-expired keys." + end + end + end + end +end |