Sha256: a5a3a69229593ba6972b91cbdd25e6e1d2d59b0515f4a85dac55b9026e739263

Contents?: true

Size: 556 Bytes

Versions: 3

Compression:

Stored size: 556 Bytes

Contents

require "vagrant/util/shell_quote"

module VagrantPlugins
  module GuestFreeBSD
    module Cap
      class RemovePublicKey
        def self.remove_public_key(machine, contents)
          contents = contents.chomp
          contents = Vagrant::Util::ShellQuote.escape(contents, "'")

          machine.communicate.tap do |comm|
            if comm.test("test -f ~/.ssh/authorized_keys")
              comm.execute(
                "sed -i '/^.*#{contents}.*$/d' ~/.ssh/authorized_keys")
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/guests/freebsd/cap/remove_public_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/guests/freebsd/cap/remove_public_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/guests/freebsd/cap/remove_public_key.rb