vagrant-g5k 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d89da08d5caa6cb1280810ea3b72c91d091959f
4
+ data.tar.gz: 562b0b9462ec699626dfed30a907219e24e3cdaa
5
+ SHA512:
6
+ metadata.gz: 3b7fa93d98a64919513727151de469ea73d0a34650e9e3f1047a1f2435afcbe722a302683d8d56d829831015982e26593749e65871409839075e2a6196c528dc
7
+ data.tar.gz: 2fcbb539674ee55ccd6ddb771d17cfcd0bc4f566f8c15d483fda47949c4373abe67ee52cf3679a95c15e3e826b6c32d81d79b1efbdbfce7a562cbe5781e4ba03
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ # OS-specific
2
+ .DS_Store
3
+
4
+ # editors
5
+ *.swp
6
+
7
+ # Bundler/Rubygems
8
+ *.gem
9
+ .bundle
10
+ pkg/*
11
+ tags
12
+ Gemfile.lock
13
+
14
+ # Vagrant
15
+ .vagrant
16
+ Vagrantfile
17
+ !example_box/Vagrantfile
18
+
19
+ # RVM files for gemset/ruby setting
20
+ .ruby-*
21
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --format doc --order random --color --fail-fast
data/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # 0.6.1
2
+
3
+ * Added configurable instance state check interval
4
+
5
+ # 0.6.0 (December 13, 2014)
6
+
7
+ * Support static Elastic IP addresses.
8
+ * Support for creating AMIs with the `vagrant package`
9
+
10
+ # 0.5.0 (June 22, 2014)
11
+
12
+ * Support for associating public IPs for VMs inside of VPCs (GH
13
+ [#219](https://github.com/mitchellh/vagrant-aws/pull/219), GH
14
+ [#205](https://github.com/mitchellh/vagrant-aws/issues/205))
15
+ * Bug-fix for per region configs with `associate_public_ip` (GH
16
+ [#237](https://github.com/mitchellh/vagrant-aws/pull/237))
17
+ * rsyncing folders uses `--delete` flag to better emulate "real shared folders
18
+ (GH [#194](https://github.com/mitchellh/vagrant-aws/pull/194))
19
+ * fog gem version bumped to 1.22 (GH [#253](https://github.com/mitchellh/vagrant-aws/pull/253))
20
+ * Simple ELB support (GH [#88](https://github.com/mitchellh/vagrant-aws/pull/88),
21
+ GH [#238](https://github.com/mitchellh/vagrant-aws/pull/238))
22
+
23
+ # 0.4.1 (December 17, 2013)
24
+
25
+ * Update fog.io to 1.18.0
26
+ * Fix sync folder user permissions (GH #175)
27
+ * Fix vagrant < 1.3.0 provisioner compatibility (GH #173)
28
+ * Add vagrant 1.4.0 multiple SSH key support (GH #172)
29
+ * Fix EIP deallocation bug (GH #164)
30
+ * Add (per shared folder) rsync exclude flag (GH #156)
31
+
32
+ # 0.4.0 (October 11, 2013)
33
+
34
+ * Handle EIP allocation error (GH #134)
35
+ * Implement halt and reload (GH #31)
36
+ * rsync ignores Vagrantfile
37
+ * warn if none of the security groups allows incoming SSH
38
+ * bump fog.io to 1.15.0
39
+ * Fix rsync on windows (GH #77)
40
+ * Add `ssh_host_attribute` config (GH #143)
41
+
42
+ # 0.3.0 (September 2, 2013)
43
+
44
+ * Parallelize multi-machine up on Vagrant 1.2+
45
+ * Show proper configuration errors if an invalid configuration key
46
+ is used.
47
+ * Request confirmation on `vagrant destroy`, like normal VirtualBox + Vagrant.
48
+ * If user data is configured, output is shown on "vagrant up" that
49
+ it is being set.
50
+ * Add EIP support (GH #65)
51
+ * Add block device mapping support (GH #93)
52
+ * README improvements (GH #120)
53
+ * Fix missing locale message (GH #73)
54
+ * SyncFolders creates hostpath if it doesn't exist and `:create` option is set (GH #17)
55
+ * Add IAM Instance Profile support (GH #68)
56
+ * Add shutdown behavior support (GH #125,#131)
57
+
58
+ # 0.2.2 (April 18, 2013)
59
+
60
+ * Fix crashing bug with incorrect provisioner arguments.
61
+
62
+ # 0.2.1 (April 16, 2013)
63
+
64
+ * Got rid of extranneous references to old SSH settings.
65
+
66
+ # 0.2.0 (April 16, 2013)
67
+
68
+ * Add support for `vagrant ssh -c` [GH-42]
69
+ * Ability to specify a timeout for waiting for instances to become ready. [GH-44]
70
+ * Better error message if instance didn't become ready in time.
71
+ * Connection can now be done using IAM profiles. [GH-41]
72
+
73
+ # 0.1.3 (April 9, 2013)
74
+
75
+ * The `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` will be used if available
76
+ and no specific keys are set in the Vagrantfile. [GH-33]
77
+ * Fix issues with SSH on VPCs, the correct IP is used. [GH-30]
78
+ * Exclude the ".vagrant" directory from rsync.
79
+ * Implement `:disabled` flag support for shared folders. [GH-29]
80
+ * `aws.user_data` to specify user data on the instance. [GH-26]
81
+
82
+ # 0.1.2 (March 22, 2013)
83
+
84
+ * Choose the proper region when connecting to AWS. [GH-9]
85
+ * Configurable SSH port. [GH-13]
86
+ * Support other AWS-compatible API endpoints with `config.endpoint`
87
+ and `config.version`. [GH-6]
88
+ * Disable strict host key checking on rsync so known hosts aren't an issue. [GH-7]
89
+
90
+ # 0.1.1 (March 18, 2013)
91
+
92
+ * Up fog dependency for Vagrant 1.1.1
93
+
94
+ # 0.1.0 (March 14, 2013)
95
+
96
+ * Initial release.
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ # We depend on Vagrant for development, but we don't add it as a
7
+ # gem dependency because we expect to be installed within the
8
+ # Vagrant environment itself using `vagrant plugin`.
9
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git"
10
+ end
11
+
12
+ group :plugins do
13
+ gem "vagrant-g5k" , path: "."
14
+ end
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Matthieu Simonin
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Vagrant G5K Provider
2
+ This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [G5K](https://www.grid5000.fr)
3
+ provider to Vagrant, allowing Vagrant to control and provision machines in
4
+ Grid5000.
5
+
6
+ **NOTE:** This plugin requires Vagrant 1.2+,
7
+
8
+ ## Features
9
+
10
+ * Boot one vm instance
11
+ * SSH into the instances.
12
+
13
+ ## Usage
14
+
15
+ Install using standard Vagrant 1.1+ plugin installation methods. After
16
+ installing, `vagrant up` and specify the `g5k` provider. An example is
17
+ shown below.
18
+
19
+ ```
20
+ $ vagrant plugin install vagrant-g5k
21
+ ...
22
+ $ vagrant up --provider=g5k
23
+ ...
24
+ ```
25
+ ## Configuration
26
+
27
+ As an example we give this Vagrantfile:
28
+
29
+
30
+
31
+ ```ruby
32
+ # -*- mode: ruby -*-
33
+ # vi: set ft=ruby :
34
+ #
35
+
36
+ Vagrant.configure(2) do |config|
37
+ # box isn't used
38
+ config.vm.box = "public/alpine_docker"
39
+ # user to log with inside the vm
40
+ config.ssh.username = "root"
41
+ # password to use to log inside the vm
42
+ config.ssh.password = ""
43
+
44
+ config.vm.provider "g5k" do |g5k|
45
+ g5k.username = "msimonin"
46
+ g5k.site = "lille"
47
+ g5k.image_location = "/home/msimonin/public/alpine_docker.qcow2"
48
+ g5k.image_type = "local"
49
+ g5k.image_strategy = "snapshot"
50
+ end
51
+
52
+ end
53
+ ```
@@ -0,0 +1,18 @@
1
+ require "pathname"
2
+
3
+ require "vagrant-g5k/plugin"
4
+
5
+ module VagrantPlugins
6
+ module G5K
7
+ lib_path = Pathname.new(File.expand_path("../vagrant-g5k", __FILE__))
8
+ autoload :Action, lib_path.join("action")
9
+ autoload :Errors, lib_path.join("errors")
10
+
11
+ # This returns the path to the source of this plugin.
12
+ #
13
+ # @return [Pathname]
14
+ def self.source_root
15
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
16
+ end
17
+ end
18
+ end
Binary file
@@ -0,0 +1,79 @@
1
+ require "pathname"
2
+
3
+ require "vagrant/action/builder"
4
+
5
+ module VagrantPlugins
6
+ module G5K
7
+ module Action
8
+ # Include the built-in modules so we can use them as top-level things.
9
+ include Vagrant::Action::Builtin
10
+
11
+ # This action is called to read the state of the machine. The
12
+ # resulting state is expected to be put into the `:machine_state_id`
13
+ # key.
14
+ def self.action_read_state
15
+ Vagrant::Action::Builder.new.tap do |b|
16
+ b.use ConfigValidate
17
+ b.use ConnectG5K
18
+ b.use ReadState
19
+ end
20
+ end
21
+
22
+ # This action is called to read the SSH info of the machine. The
23
+ # resulting state is expected to be put into the `:machine_ssh_info`
24
+ # key.
25
+ def self.action_read_ssh_info
26
+ Vagrant::Action::Builder.new.tap do |b|
27
+ b.use ConfigValidate
28
+ b.use ConnectG5K
29
+ # read the state to find the enclosing ressource
30
+ b.use ReadState
31
+ b.use ReadSSHInfo
32
+ end
33
+ end
34
+
35
+ # This action is called to SSH into the machine.
36
+ def self.action_ssh
37
+ Vagrant::Action::Builder.new.tap do |b|
38
+ b.use ConfigValidate
39
+ b.use Call, IsCreated do |env, b2|
40
+ if !env[:result]
41
+ b2.use MessageNotCreated
42
+ next
43
+ end
44
+ b2.use SSHExec
45
+ end
46
+ end
47
+ end
48
+
49
+ # This action is called to bring the box up from nothing.
50
+ def self.action_up
51
+ Vagrant::Action::Builder.new.tap do |b|
52
+ b.use ConfigValidate
53
+ b.use ConnectG5K
54
+ b.use CreateLocalWorkingDir
55
+ b.use Call, IsCreated do |env1, b1|
56
+ if env1[:result] then
57
+ b1.use MessageAlreadyCreated
58
+ else
59
+ b1.use RunInstance # launch a new instance
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ action_root = Pathname.new(File.expand_path("../action", __FILE__))
66
+ autoload :MessageAlreadyCreated, action_root.join("message_already_created")
67
+ autoload :MessageNotCreated, action_root.join("message_not_created")
68
+ autoload :ReadSSHInfo, action_root.join("read_ssh_info")
69
+ autoload :ReadState, action_root.join("read_state")
70
+ autoload :ConnectG5K, action_root.join("connect_g5k")
71
+ autoload :CreateLocalWorkingDir, action_root.join("create_local_working_dir")
72
+ autoload :StartInstance, action_root.join("start_instance")
73
+ autoload :IsCreated, action_root.join("is_created")
74
+ autoload :RunInstance, action_root.join("run_instance")
75
+
76
+ end
77
+ end
78
+ end
79
+
@@ -0,0 +1,28 @@
1
+ require "log4r"
2
+ require "vagrant-g5k/util/g5k_utils"
3
+
4
+ module VagrantPlugins
5
+ module G5K
6
+ module Action
7
+ # This action connects to G5K, verifies credentials work, and
8
+ # puts the G5K connection object into the `:g5k_connection` key
9
+ # in the environment.
10
+ class ConnectG5K
11
+ def initialize(app, env)
12
+ @app = app
13
+ @logger = Log4r::Logger.new("vagrant_g5k::action::connect_g5k")
14
+ end
15
+
16
+ def call(env)
17
+ env[:g5k_connection] = Connection.new(
18
+ :logger => env[:ui],
19
+ :username => env[:machine].provider_config.username,
20
+ :image_location => env[:machine].provider_config.image_location,
21
+ :site => env[:machine].provider_config.site
22
+ )
23
+ @app.call(env)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ require "log4r"
2
+ require 'json'
3
+ require 'yaml'
4
+
5
+
6
+ module VagrantPlugins
7
+ module G5K
8
+ module Action
9
+ # This runs the configured instance.
10
+ class CreateLocalWorkingDir
11
+
12
+ def initialize(app, env)
13
+ @app = app
14
+ @logger = Log4r::Logger.new("vagrant_g5k::action::run_instance")
15
+ end
16
+
17
+ def call(env)
18
+ conn = env[:g5k_connection]
19
+ conn.create_local_working_dir(env)
20
+ @app.call(env)
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,18 @@
1
+ module VagrantPlugins
2
+ module G5K
3
+ module Action
4
+ # This can be used with "Call" built-in to check if the machine
5
+ # is created and branch in the middleware.
6
+ class IsCreated
7
+ def initialize(app, env)
8
+ @app = app
9
+ end
10
+
11
+ def call(env)
12
+ env[:result] = env[:machine].state.id != :not_created
13
+ @app.call(env)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module VagrantPlugins
2
+ module G5K
3
+ module Action
4
+ class MessageAlreadyCreated
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ env[:ui].info("vagrant_g5k.already_status", :status => "created")
11
+ @app.call(env)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module VagrantPlugins
2
+ module G5K
3
+ module Action
4
+ class MessageNotCreated
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ env[:ui].info("vagrant_g5k.not_created")
11
+ @app.call(env)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ require "log4r"
2
+
3
+ module VagrantPlugins
4
+ module G5K
5
+ module Action
6
+ # This action reads the SSH info for the machine and puts it into the
7
+ # `:machine_ssh_info` key in the environment.
8
+ class ReadSSHInfo
9
+ def initialize(app, env)
10
+ @app = app
11
+ @logger = Log4r::Logger.new("vagrant_g5k::action::read_ssh_info")
12
+ end
13
+
14
+ def call(env)
15
+ env[:machine_ssh_info] = read_ssh_info(env[:g5k_connection], env[:machine])
16
+
17
+ @app.call(env)
18
+ end
19
+
20
+ def read_ssh_info(conn, machine)
21
+ return nil if machine.id.nil?
22
+
23
+ return { :host => conn.ip,
24
+ :proxy_command => "ssh #{conn.username}@access.grid5000.fr nc %h %p",
25
+ }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end