Skip to content

Commit

Permalink
fixed error message when plugin cannot find node with openvpn.server_…
Browse files Browse the repository at this point in the history
…name attribute
  • Loading branch information
whitew1nd committed Nov 23, 2015
1 parent 08433a7 commit 6a572ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/chef/knife/openvpn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ def export_user(server_name, user_name)
user_item = load_databag_item(databag_name, user_name)
user_cert, _user_key = load_cert_and_key user_item['cert'], user_item['key']
tmpdir = Dir.mktmpdir
ui.msg "created tmpdir: #{tmpdir}"
#ui.msg "created tmpdir: #{tmpdir}"
begin
user_dir = "#{tmpdir}/#{user_name}-vpn"
Dir.mkdir user_dir
ui.msg "created userdir: #{user_dir}"
#ui.msg "created userdir: #{user_dir}"
export_file "#{user_dir}/ca.crt", ca_cert.to_pem
export_file "#{user_dir}/#{user_name}.crt", user_cert.to_pem
export_file "#{user_dir}/#{user_name}.key", user_item['key'].to_s
Expand Down Expand Up @@ -406,7 +406,7 @@ def generate_client_config(server_name, user_name)
query_nodes = Chef::Search::Query.new
search_result = query_nodes.search('node', query)[0]
if search_result.length < 1
fail_with "Cant find vpn server named '#{server_name}'"
fail_with "Cant find vpn server named '#{server_name}', chef search for node with attribute openvpn.server_name:#{server_name} return no result"
end
config_content = ''
newline = "\n"
Expand Down

0 comments on commit 6a572ee

Please sign in to comment.