Sha256: 82a0018682e3b70c5916d9da0e1a18e37b1bb0e4c41bad73a8f125b40ec2966c

Contents?: true

Size: 500 Bytes

Versions: 7

Compression:

Stored size: 500 Bytes

Contents

require "vagrant/util/shell_quote"

module VagrantPlugins
  module GuestOpenWrt
    module Cap
      class InsertPublicKey
        def self.insert_public_key(machine, contents)
          contents = contents.chomp
          contents = Vagrant::Util::ShellQuote.escape(contents, "'")

          machine.communicate.tap do |comm|
            comm.execute <<~EOH
              printf '#{contents}\\n' >> /etc/dropbear/authorized_keys
            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/insert_public_key.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/guests/openwrt/cap/insert_public_key.rb
vagrant-unbundled-2.3.3.0 plugins/guests/openwrt/cap/insert_public_key.rb
vagrant-unbundled-2.3.2.0 plugins/guests/openwrt/cap/insert_public_key.rb
vagrant-unbundled-2.2.19.0 plugins/guests/openwrt/cap/insert_public_key.rb
vagrant-unbundled-2.2.18.0 plugins/guests/openwrt/cap/insert_public_key.rb
vagrant-unbundled-2.2.16.0 plugins/guests/openwrt/cap/insert_public_key.rb