Sha256: b877418ef82ce6dc063b2e46a2daf3b9888a8be62cb74f2f3296869d6414876a

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

require "vagrant/util/shell_quote"

module VagrantPlugins
  module GuestSolaris11
    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

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/bundler/gems/vagrant-c84e05fd063f/plugins/guests/solaris11/cap/remove_public_key.rb