Sha256: 8b5b07a004ba761d5f45f6e42c3c6ed0ca0c9833e4b6ec546f1a846196f6af54

Contents?: true

Size: 584 Bytes

Versions: 7

Compression:

Stored size: 584 Bytes

Contents

require "vagrant/util/shell_quote"

module VagrantPlugins
  module GuestOpenWrt
    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|
            comm.execute <<~EOH
              if test -f /etc/dropbear/authorized_keys ; then
                sed -i '/^.*#{contents}.*$/d' /etc/dropbear/authorized_keys
              fi
            EOH
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/guests/openwrt/cap/remove_public_key.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/guests/openwrt/cap/remove_public_key.rb
vagrant-unbundled-2.3.3.0 plugins/guests/openwrt/cap/remove_public_key.rb
vagrant-unbundled-2.3.2.0 plugins/guests/openwrt/cap/remove_public_key.rb
vagrant-unbundled-2.2.19.0 plugins/guests/openwrt/cap/remove_public_key.rb
vagrant-unbundled-2.2.18.0 plugins/guests/openwrt/cap/remove_public_key.rb
vagrant-unbundled-2.2.16.0 plugins/guests/openwrt/cap/remove_public_key.rb