File: ssh.rb

package info (click to toggle)
vagrant 2.2.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,072 kB
  • sloc: ruby: 80,731; sh: 369; makefile: 9; lisp: 1
file content (26 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module VagrantPlugins
  module HostWindows
    module Cap
      class SSH
        # Set the ownership and permissions for SSH
        # private key
        #
        # @param [Vagrant::Environment] env
        # @param [Pathname] key_path
        def self.set_ssh_key_permissions(env, key_path)
          script_path = Host.scripts_path.join("set_ssh_key_permissions.ps1")
          result = Vagrant::Util::PowerShell.execute(
            script_path.to_s, "-KeyPath", key_path.to_s,
            module_path: Host.modules_path.to_s
          )
          if result.exit_code != 0
            raise Vagrant::Errors::PowerShellError,
              script: script_path,
              stderr: result.stderr
          end
          result
        end
      end
    end
  end
end