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 +4 -4
- data/.gitignore +0 -1
- data/Vagrantfile +38 -0
- data/lib/vagrant-g5k/action/connect_g5k.rb +1 -0
- data/lib/vagrant-g5k/action/read_ssh_info.rb +15 -4
- data/lib/vagrant-g5k/config.rb +5 -0
- data/lib/vagrant-g5k/util/g5k_utils.rb +8 -2
- data/lib/vagrant-g5k/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 043f3958657451cc6b632023f0d8af571b172a61
|
4
|
+
data.tar.gz: 80ef66e4918d63bfefb0f27878c9d5ce4348fb5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb8a65146f1752975ddb92363f47c1af6f63d6893b2a041c6aab2a700eeccf5937f4fb0ae751115fe8d3c3b8aec282d1cf4fbb689144987e429e978427b55fee
|
7
|
+
data.tar.gz: d724bd697b85cc1d674ba8a2ab744a29af278ffc08fcb2c70742dac5144cfb457d5a4425cbf8c7031364150a5c1fd8a03e98913e08aac03c3011d5566adc6f66
|
data/.gitignore
CHANGED
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
|
-
|
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
|
data/lib/vagrant-g5k/config.rb
CHANGED
@@ -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
|
-
|
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()
|
data/lib/vagrant-g5k/version.rb
CHANGED
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.
|
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-
|
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
|