lib/chef/knife/encrypt_rotate_keys.rb in chef-vault-2.1.0 vs lib/chef/knife/encrypt_rotate_keys.rb in chef-vault-2.2.0
- old
+ new
@@ -11,52 +11,23 @@
# 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.
-require 'chef/knife'
-require 'chef-vault'
+require 'chef/knife/vault_base'
+require 'chef/knife/vault_rotate_keys'
-class EncryptRotateKeys < Chef::Knife
- deps do
- require 'chef/search/query'
- require File.expand_path('../mixin/compat', __FILE__)
- require File.expand_path('../mixin/helper', __FILE__)
- include ChefVault::Mixin::KnifeCompat
- include ChefVault::Mixin::Helper
- end
+class Chef
+ class Knife
+ class EncryptRotateKeys < VaultRotateKeys
- banner "knife encrypt rotate keys VAULT ITEM --mode MODE"
+ include Knife::VaultBase
- option :mode,
- :short => '-M MODE',
- :long => '--mode MODE',
- :description => 'Chef mode to run in default - solo'
+ banner "knife encrypt rotate keys VAULT ITEM (options)"
- def run
- vault = @name_args[0]
- item = @name_args[1]
-
- if vault && item
- set_mode(config[:mode])
-
- begin
- item = ChefVault::Item.load(vault, item)
- item.rotate_keys!
- rescue ChefVault::Exceptions::KeysNotFound,
- ChefVault::Exceptions::ItemNotFound
-
- raise ChefVault::Exceptions::ItemNotFound,
- "#{vault}/#{item} does not exists, "\
- "use 'knife encrypt create' to create."
+ def run
+ puts "DEPRECATION WARNING: knife encrypt is deprecated. Please use knife vault instead."
+ super
end
- else
- show_usage
end
end
-
- def show_usage
- super
- exit 1
- end
end
-