summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortylercloke <tylercloke@gmail.com>2015-04-28 10:07:20 -0700
committertylercloke <tylercloke@gmail.com>2015-04-28 11:54:27 -0700
commite17fcb67c878b8c4d64ea1992556690f6f508e1c (patch)
tree581c812ddd5cf003bc881d8a0def39f9b6e129a3
parentb78a0b63eb3b04002e57e1702d9f2d8c500f8165 (diff)
downloadchef-e17fcb67c878b8c4d64ea1992556690f6f508e1c.tar.gz
Fix review comments (will squash).
-rw-r--r--lib/chef/knife/client_key_create.rb1
-rw-r--r--lib/chef/knife/key_create.rb31
-rw-r--r--lib/chef/knife/user_key_create.rb1
-rw-r--r--spec/unit/key_spec.rb8
-rw-r--r--spec/unit/knife/key_create_spec.rb4
5 files changed, 10 insertions, 35 deletions
diff --git a/lib/chef/knife/client_key_create.rb b/lib/chef/knife/client_key_create.rb
index baf1c5aa76..372655b7ab 100644
--- a/lib/chef/knife/client_key_create.rb
+++ b/lib/chef/knife/client_key_create.rb
@@ -63,7 +63,6 @@ class Chef
def run
apply_params!(@name_args)
service_object.run
- 0
end
def actor_field_name
diff --git a/lib/chef/knife/key_create.rb b/lib/chef/knife/key_create.rb
index 30f48e13f0..38eb7e1f02 100644
--- a/lib/chef/knife/key_create.rb
+++ b/lib/chef/knife/key_create.rb
@@ -18,24 +18,6 @@
require 'chef/key'
require 'chef/json_compat'
-#
-# 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.
-#
-
require 'chef/exceptions'
class Chef
@@ -75,7 +57,7 @@ EOS
end
def display_private_key(private_key)
- @ui.msg private_key
+ @ui.msg(private_key)
end
def output_private_key_to_file(private_key)
@@ -93,21 +75,21 @@ EOS
if !@config[:public_key] && !@config[:key_name]
raise Chef::Exceptions::KeyCommandInputError, public_key_or_key_name_error_msg
elsif !@config[:public_key]
- key.create_key true
+ key.create_key(true)
end
if @config[:public_key]
- key.public_key File.read(File.expand_path(@config[:public_key]))
+ key.public_key(File.read(File.expand_path(@config[:public_key])))
end
if @config[:key_name]
- key.name @config[:key_name]
+ key.name(@config[:key_name])
end
if @config[:expiration_date]
- key.expiration_date @config[:expiration_date]
+ key.expiration_date(@config[:expiration_date])
else
- key.expiration_date "infinity"
+ key.expiration_date("infinity")
end
output = edit_data(key)
@@ -121,7 +103,6 @@ EOS
display_private_key(key.private_key)
end
end
-
end
end
end
diff --git a/lib/chef/knife/user_key_create.rb b/lib/chef/knife/user_key_create.rb
index 9bd0b789fa..4434ec87b3 100644
--- a/lib/chef/knife/user_key_create.rb
+++ b/lib/chef/knife/user_key_create.rb
@@ -63,7 +63,6 @@ class Chef
def run
apply_params!(@name_args)
service_object.run
- 0
end
def actor_field_name
diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb
index a2bc6dcdd4..8ef7d24f21 100644
--- a/spec/unit/key_spec.rb
+++ b/spec/unit/key_spec.rb
@@ -520,15 +520,15 @@ EOS
context "when updating a user key" do
it_should_behave_like "update key" do
- let(:url) { "users/#{key.actor}/keys/#{key.name}" }
- let(:key) { user_key }
+ let(:url) { "users/#{key.actor}/keys/#{key.name}" }
+ let(:key) { user_key }
end
end
context "when updating a client key" do
it_should_behave_like "update key" do
- let(:url) { "clients/#{client_key.actor}/keys/#{key.name}" }
- let(:key) { client_key }
+ let(:url) { "clients/#{client_key.actor}/keys/#{key.name}" }
+ let(:key) { client_key }
end
end
diff --git a/spec/unit/knife/key_create_spec.rb b/spec/unit/knife/key_create_spec.rb
index 7598622ea1..a02573b486 100644
--- a/spec/unit/knife/key_create_spec.rb
+++ b/spec/unit/knife/key_create_spec.rb
@@ -85,10 +85,6 @@ describe "key create commands that inherit knife" do
before do
expect(service_object).to receive(:run)
end
-
- it "returns 0" do
- expect(command.run).to eq(0)
- end
end
end
end # a key create command