lib/chef/knife/cloud/google_service_helpers.rb in knife-google-4.2.14 vs lib/chef/knife/cloud/google_service_helpers.rb in knife-google-5.0.0

- old
+ new

@@ -1,9 +1,9 @@ # frozen_string_literal: true # # Author:: Chef Partner Engineering (<partnereng@chef.io>) -# Copyright:: Copyright (c) 2016 Chef Software, Inc. +# Copyright:: Copyright (c) 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 @@ -21,22 +21,22 @@ module GoogleServiceHelpers REQUIRED_KEYS = [:gce_project].freeze def create_service_instance Chef::Knife::Cloud::GoogleService.new( - project: locate_config_value(:gce_project), - zone: locate_config_value(:gce_zone), - wait_time: locate_config_value(:request_timeout), - refresh_rate: locate_config_value(:request_refresh_rate), - max_pages: locate_config_value(:gce_max_pages), - max_page_size: locate_config_value(:gce_max_page_size) + project: config[:gce_project], + zone: config[:gce_zone], + wait_time: config[:request_timeout], + refresh_rate: config[:request_refresh_rate], + max_pages: config[:gce_max_pages], + max_page_size: config[:gce_max_page_size] ) end def check_for_missing_config_values!(*keys) keys_to_check = REQUIRED_KEYS + keys - missing = keys_to_check.select { |x| locate_config_value(x).nil? } + missing = keys_to_check.select { |x| config[x].nil? } unless missing.empty? message = "The following required parameters are missing: #{missing.join(", ")}" ui.error(message) raise message