Sha256: aab96adf7a8e38819e4ba60ad23350339606ef465b7ca39aa80993af812bc671

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

require "vagrant/util/shell_quote"

module VagrantPlugins
  module GuestSolaris
    module Cap
      class RemovePublicKey
        def self.remove_public_key(machine, contents)
          # TODO: code is identical to linux/cap/remove_public_key
          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/solaris/cap/remove_public_key.rb