vagrant-terraform 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/build-gem.yml +32 -0
- data/README.md +6 -1
- data/lib/vagrant-terraform/action/wait_for_vm_up.rb +19 -15
- data/lib/vagrant-terraform/action.rb +2 -2
- data/lib/vagrant-terraform/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b0980af98e95f4a9587641a569daeb896410b4bb86990d46f1816967321ebfd
|
4
|
+
data.tar.gz: 48c0115b522bb13890487a8854f6d771a7b4dda7196287105cbc740bbf4571cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6099a9a5c0029347b8d4f9ced88266ebeb62a2e21d8b9d92803d79ffe1b02af46ac619d3308feb1dd9148dc5e84fc5b096c449403c2e44e27987d41d5dcdb1d0
|
7
|
+
data.tar.gz: f8d825bdc67246c31e4cb0fb99f8b10eeb1f91563800ca195300bb74e7947f05e943fae52fdf6ce7325cdbed7d6d060db50a4debcfb399526a030c86c0f296ec
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
tags:
|
5
|
+
- release/*
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
- name: Set up Ruby 3.3.6
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 3.3.6
|
21
|
+
|
22
|
+
- name: Publish to RubyGems
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push *.gem
|
30
|
+
env:
|
31
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
32
|
+
|
data/README.md
CHANGED
@@ -7,7 +7,6 @@ Could be extended to support other Terraform providers in addition to Proxmox bu
|
|
7
7
|
the moment I'm not planning to.
|
8
8
|
|
9
9
|
Things I'm _not_ planning to do (due to lack of time and resources):
|
10
|
-
* Put this in rubygems.org. If you want to use this, roll your own gem like instructed below.
|
11
10
|
* Support other Terraform providers unless I have to move away from Proxmox to something else.
|
12
11
|
* Add support for suspend / snapshots.
|
13
12
|
* Support / test anything other than Ubuntu/Fedora
|
@@ -15,6 +14,12 @@ Things I'm _not_ planning to do (due to lack of time and resources):
|
|
15
14
|
|
16
15
|
## Installation
|
17
16
|
|
17
|
+
From rubygems.org
|
18
|
+
```
|
19
|
+
vagrant plugin install vagrant-terraform
|
20
|
+
```
|
21
|
+
|
22
|
+
Build & install:
|
18
23
|
```
|
19
24
|
$ gem build *.gemspec
|
20
25
|
$ vagrant plugin install *.gem
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'log4r'
|
2
|
-
require 'vagrant-terraform/util/timer'
|
3
|
-
require 'vagrant-terraform/util/terraform_execute'
|
4
2
|
require 'socket'
|
5
3
|
require 'timeout'
|
4
|
+
require 'vagrant-terraform/util/timer'
|
5
|
+
require 'vagrant-terraform/util/terraform_execute'
|
6
|
+
Vagrant.require 'net/ssh'
|
6
7
|
|
7
8
|
module VagrantPlugins
|
8
9
|
module TerraformProvider
|
@@ -18,21 +19,24 @@ module VagrantPlugins
|
|
18
19
|
@app = app
|
19
20
|
end
|
20
21
|
|
21
|
-
def port_open?(ip
|
22
|
-
#
|
23
|
-
|
22
|
+
def port_open?(ip)
|
23
|
+
# Check if ssh server responds, AuthenticationFailed is what we expect to get.
|
24
|
+
# If credentials vagrant:vagrant happen to work that's a success as well.
|
25
|
+
begin
|
24
26
|
begin
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
false
|
27
|
+
ssh = Net::SSH.start(ip, "vagrant", password: "vagrant",
|
28
|
+
non_interactive: true, user_known_hosts_file: [],
|
29
|
+
verify_host_key: :never)
|
30
|
+
ensure
|
31
|
+
ssh&.close
|
31
32
|
end
|
33
|
+
return true
|
34
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
35
|
+
return false
|
36
|
+
rescue Net::SSH::AuthenticationFailed
|
37
|
+
return true
|
32
38
|
end
|
33
|
-
|
34
|
-
@logger.info("SSH Connection Failed: Timeout for IP: #{ip}" )
|
35
|
-
false
|
39
|
+
return false
|
36
40
|
end
|
37
41
|
|
38
42
|
def call(env)
|
@@ -51,7 +55,7 @@ module VagrantPlugins
|
|
51
55
|
unless ip_addr.nil?
|
52
56
|
env[:ui].info("Got IP (attempt #{attempt}): #{ip_addr}")
|
53
57
|
# Check if SSH-Server is up
|
54
|
-
if port_open?(ip_addr
|
58
|
+
if port_open?(ip_addr)
|
55
59
|
env[:ip_address] = ip_addr
|
56
60
|
@logger.debug("Got output #{env[:ip_address]}")
|
57
61
|
break
|
@@ -56,8 +56,8 @@ module VagrantPlugins
|
|
56
56
|
end
|
57
57
|
|
58
58
|
b2.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup)
|
59
|
-
|
60
|
-
# b2.use
|
59
|
+
# Maybe with sshfs clean halting could be beneficial
|
60
|
+
# b2.use HaltVM unless env[:machine].state.id == :stopped
|
61
61
|
b2.use DestroyVM
|
62
62
|
end
|
63
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-terraform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mika Båtsman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filesize
|
@@ -31,6 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".github/workflows/build-gem.yml"
|
34
35
|
- ".gitignore"
|
35
36
|
- Gemfile
|
36
37
|
- Gemfile.lock
|
@@ -68,7 +69,7 @@ homepage: https://github.com/mika-b/vagrant-terraform
|
|
68
69
|
licenses:
|
69
70
|
- MIT
|
70
71
|
metadata: {}
|
71
|
-
post_install_message:
|
72
|
+
post_install_message:
|
72
73
|
rdoc_options: []
|
73
74
|
require_paths:
|
74
75
|
- lib
|
@@ -83,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
84
|
- !ruby/object:Gem::Version
|
84
85
|
version: '0'
|
85
86
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
87
|
-
signing_key:
|
87
|
+
rubygems_version: 3.5.22
|
88
|
+
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: This vagrant plugin provides the ability to create, control, and destroy
|
90
91
|
virtual machines under proxmox
|