Purge   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 3 1
A apply() 0 7 1
1
# frozen_string_literal: true
2
3
require_relative '../../../action'
4
require_relative '../../../helper/ssh_methods'
5
6
module AMA
7
  module Chef
8
    module User
9
      class Action
10
        module Account
11
          module PublicKey
12
            class Purge < Action
13
              include Helper::SSHMethods
14
15
              attr_accessor :account
16
17
              # @param [AMA::Chef::User::Model::Account] account
18
              def initialize(account)
19
                @account = account
20
              end
21
22
              def apply(resource_factory)
23
                resource_id = "#{ssh_directory(@account.id)}/authorized_keys"
24
                ::Chef::Log.debug("Purging ssh keys for account #{@account.id}")
25
                resource_factory.file resource_id do
26
                  action :delete
27
                end
28
              end
29
            end
30
          end
31
        end
32
      end
33
    end
34
  end
35
end
36