diff --git a/lib/do_snapshot/cli.rb b/lib/do_snapshot/cli.rb index 2c1d90b..1db586a 100644 --- a/lib/do_snapshot/cli.rb +++ b/lib/do_snapshot/cli.rb @@ -27,7 +27,7 @@ def initialize(*args) set_mailer # Check for keys via options - %w( digital_ocean_client_id digital_ocean_api_key digital_ocean_access_token ).each do |key| + %w( digital_ocean_access_token ).each do |key| ENV[key.upcase] = options[key] if options.include? key end end @@ -40,9 +40,9 @@ def initialize(*args) ### Examples - Select api version (1, 2): + Select api version (2): - $ do_snapshot -p 1 + $ do_snapshot -p 2 Set DigitalOcean keys: @@ -151,14 +151,6 @@ def initialize(*args) type: :string, banner: 'YOURLONGAPITOKEN', desc: 'DIGITAL_OCEAN_ACCESS_TOKEN. if you can\'t use environment.' - method_option :digital_ocean_client_id, - type: :string, - banner: 'YOURLONGAPICLIENTID', - desc: 'DIGITAL_OCEAN_CLIENT_ID. if you can\'t use environment.' - method_option :digital_ocean_api_key, - type: :string, - banner: 'YOURLONGAPIKEY', - desc: 'DIGITAL_OCEAN_API_KEY. if you can\'t use environment.' def snap command.snap @@ -197,7 +189,7 @@ def update_command end def command_filter - %w( log smtp mail trace digital_ocean_client_id digital_ocean_api_key digital_ocean_access_token ) + %w( log smtp mail trace digital_ocean_access_token ) end def setup_config # rubocop:disable Metrics/AbcSize diff --git a/spec/do_snapshot/cli_spec.rb b/spec/do_snapshot/cli_spec.rb index 109842e..9452e53 100644 --- a/spec/do_snapshot/cli_spec.rb +++ b/spec/do_snapshot/cli_spec.rb @@ -15,7 +15,7 @@ expect(cli_obj.args) .to include('help') expect(cli_obj.options) - .to include('digital_ocean_client_id') + .to include('digital_ocean_access_token') end end end diff --git a/spec/shared/environment.rb b/spec/shared/environment.rb index d98ddec..9ea4bd3 100644 --- a/spec/shared/environment.rb +++ b/spec/shared/environment.rb @@ -16,8 +16,8 @@ def do_not_send_email let(:image_id) { '5019770' } let(:image_id2) { '5019903' } let(:cli_env_nil) { Hash['DIGITAL_OCEAN_CLIENT_ID' => nil, 'DIGITAL_OCEAN_API_KEY' => nil, 'DIGITAL_OCEAN_ACCESS_TOKEN' => nil] } - let(:cli_keys) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_client_id: client_key, digital_ocean_api_key: api_key, digital_ocean_access_token: access_token) } - let(:cli_keys_other) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_client_id: 'NOTFOO', digital_ocean_api_key: 'NOTBAR', digital_ocean_access_token: 'NOTTOK') } + let(:cli_keys) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_access_token: access_token) } + let(:cli_keys_other) { Thor::CoreExt::HashWithIndifferentAccess.new(digital_ocean_access_token: 'NOTTOK') } let(:snapshot_name) { "example.com_#{DateTime.now.strftime('%Y_%m_%d')}" } let(:default_options) { Hash[protocol: 2, only: %w( 100823 ), exclude: %w(), keep: 3, stop: false, trace: true, clean: true, delay: 0, timeout: 600] } let(:default_options_cli) { default_options.reject { |key, _| %w( droplets threads ).include?(key.to_s) } }