| Total Complexity | 2 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # frozen_string_literal: true |
||
| 12 | class Remove < Action |
||
| 13 | attr_accessor :account |
||
| 14 | attr_accessor :private_key |
||
| 15 | attr_accessor :remote |
||
| 16 | |||
| 17 | # @param [AMA::Chef::User::Model::Account] account |
||
| 18 | # @param [AMA::Chef::User::Model::PrivateKey] private_key |
||
| 19 | # @param [AMA::Chef::User::Model::PrivateKey::Remote] remote |
||
| 20 | def initialize(account, private_key, remote) |
||
| 21 | @account = account |
||
| 22 | @private_key = private_key |
||
| 23 | @remote = remote |
||
| 24 | end |
||
| 25 | |||
| 26 | def apply(resource_factory) |
||
| 27 | account = @account |
||
| 28 | key = @private_key |
||
| 29 | remote = @remote |
||
| 30 | name = "#{account.id}:#{key.owner}:#{key.id}:#{remote.id}" |
||
| 31 | resource_factory.ssh_config name do |
||
| 32 | host remote.id.to_s |
||
| 33 | user account.id.to_s |
||
| 34 | action :remove |
||
| 35 | end |
||
| 36 | end |
||
| 37 | end |
||
| 38 | end |
||
| 45 |