vagrant-g5k 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d881ded22e0ffd6c634d6404ee9b0b6d2216cc6b
4
- data.tar.gz: 7191c5867fce7ff80f0216b10f5129891fc31bab
3
+ metadata.gz: 043f3958657451cc6b632023f0d8af571b172a61
4
+ data.tar.gz: 80ef66e4918d63bfefb0f27878c9d5ce4348fb5d
5
5
  SHA512:
6
- metadata.gz: 25932a96059c4e8afe177439e258b55a933a188c08975b96f7eee3d2b0290f0ebb316ab4bd5e40ba53b4c31dde8d46e798c070ada62667cd4841e5b6e7242832
7
- data.tar.gz: 2700541904729a15a3e2344ec26ec4f4ca82a6212e34635cf18d749cc40510e82a10b362af0210b45a2cff65d6eaabdf0d363f0a255302e5619b2c6dc11a029f
6
+ metadata.gz: cb8a65146f1752975ddb92363f47c1af6f63d6893b2a041c6aab2a700eeccf5937f4fb0ae751115fe8d3c3b8aec282d1cf4fbb689144987e429e978427b55fee
7
+ data.tar.gz: d724bd697b85cc1d674ba8a2ab744a29af278ffc08fcb2c70742dac5144cfb457d5a4425cbf8c7031364150a5c1fd8a03e98913e08aac03c3011d5566adc6f66
data/.gitignore CHANGED
@@ -13,7 +13,6 @@ Gemfile.lock
13
13
 
14
14
  # Vagrant
15
15
  .vagrant
16
- Vagrantfile
17
16
  !example_box/Vagrantfile
18
17
 
19
18
  # RVM files for gemset/ruby setting
data/Vagrantfile ADDED
@@ -0,0 +1,38 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+ #
4
+ # Testing purpose only
5
+ Vagrant.require_plugin "vagrant-g5k"
6
+
7
+ Vagrant.configure(2) do |config|
8
+ # box isn't used
9
+ config.vm.define "vm" do |my|
10
+ my.vm.box = "dummy"
11
+ end
12
+
13
+ # user to log with inside the vm
14
+ config.ssh.username = "root"
15
+ # password to use to log inside the vm
16
+ config.ssh.password = ""
17
+
18
+ config.vm.provider "g5k" do |g5k|
19
+ # user name used to connect to g5k
20
+ g5k.username = ENV['USER']
21
+ # private key
22
+ # g5k.private_key = File.join(ENV['HOME'], ".ssh/id_rsa_discovery")
23
+ # site to use
24
+ g5k.site = "rennes"
25
+ # image location
26
+ g5k.image_location = "/grid5000/virt-images/alpine_docker.qcow2"
27
+ # it could be backed by the ceph
28
+ # g5k.image_location = "rbd:msimonin_rbds/virt/alpine_docker_analyse-090916:id=msimonin:conf=/home/msimonin/.ceph/config"
29
+ g5k.backing_strategy = "snapshot"
30
+ # ports to expose (at least ssh has to be forwarded)
31
+ g5k.ports = ['2222-:22']
32
+ end
33
+
34
+
35
+
36
+ end
37
+
38
+
@@ -17,6 +17,7 @@ module VagrantPlugins
17
17
  env[:g5k_connection] = Connection.new(
18
18
  :logger => env[:ui],
19
19
  :username => env[:machine].provider_config.username,
20
+ :private_key => env[:machine].provider_config.private_key,
20
21
  :image_location => env[:machine].provider_config.image_location,
21
22
  :site => env[:machine].provider_config.site,
22
23
  :ports => env[:machine].provider_config.ports,
@@ -24,6 +24,15 @@ module VagrantPlugins
24
24
  @app.call(env)
25
25
  end
26
26
 
27
+ def ssh_key(conn)
28
+ if conn.private_key.nil?
29
+ ""
30
+ else
31
+ "-i #{conn.private_key}"
32
+ end
33
+ end
34
+
35
+
27
36
  def read_ssh_info(conn, machine, ssh_fwd)
28
37
  return nil if machine.id.nil?
29
38
 
@@ -31,11 +40,13 @@ module VagrantPlugins
31
40
 
32
41
  raise Error "ssh_port should be forwarded"
33
42
  end
34
-
35
- return { :host => conn.node,
43
+ ssh_info = {
44
+ :host => conn.node,
36
45
  :port => ssh_fwd,
37
- :proxy_command => "ssh #{conn.username}@access.grid5000.fr nc %h %p",
38
- }
46
+ :proxy_command => "ssh #{conn.username}@access.grid5000.fr #{ssh_key(conn)} nc %h %p",
47
+ }
48
+ ssh_info[:private_key_path] = [conn.private_key] if ! conn.private_key.nil?
49
+ return ssh_info
39
50
  end
40
51
  end
41
52
  end
@@ -9,6 +9,11 @@ module VagrantPlugins
9
9
  # @return [String]
10
10
  attr_accessor :username
11
11
 
12
+ # G5K private_key
13
+ #
14
+ # @return [String]
15
+ attr_accessor :private_key
16
+
12
17
  # G5K site
13
18
  #
14
19
  # @return [String]
@@ -18,6 +18,8 @@ module VagrantPlugins
18
18
 
19
19
  attr_accessor :username
20
20
 
21
+ attr_accessor :private_key
22
+
21
23
  attr_accessor :site
22
24
 
23
25
  attr_accessor :image_location
@@ -46,9 +48,13 @@ module VagrantPlugins
46
48
  instance_variable_set("@#{k}", v) unless v.nil?
47
49
  end
48
50
  @logger.info("connecting with #{@username} on site #{@site}")
49
- gateway = Net::SSH::Gateway.new("access.grid5000.fr", @username, :forward_agent => true)
51
+ options = {
52
+ :forward_agent => true
53
+ }
54
+ options[:keys] = [@private_key] if !@private_key.nil?
55
+ gateway = Net::SSH::Gateway.new("access.grid5000.fr", @username, options)
50
56
 
51
- @session = gateway.ssh(@site, @username)
57
+ @session = gateway.ssh(@site, @username, options)
52
58
  end
53
59
 
54
60
  def list_images()
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module G5K
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-g5k
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Simonin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-14 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iniparse
@@ -126,6 +126,7 @@ files:
126
126
  - Gemfile
127
127
  - LICENSE
128
128
  - README.md
129
+ - Vagrantfile
129
130
  - lib/vagrant-g5k.rb
130
131
  - lib/vagrant-g5k/.config.rb.swp
131
132
  - lib/vagrant-g5k/action.rb