vagrant-shell 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.12
1
+ 0.2.13
@@ -0,0 +1,32 @@
1
+ #!/bin/bash -efu
2
+
3
+ if [[ -n "${VAGRANT_LOG:-}" ]]; then
4
+ set -x
5
+ fi
6
+
7
+ cmd="$1"; shift
8
+ case "$cmd" in
9
+ run-instance)
10
+ image="$1"; shift
11
+ cmd_bootstrap="$(which shell-docker-$image 2>&- || true)"
12
+ if [[ -x "$cmd_bootstrap" ]]; then
13
+ $cmd_bootstrap
14
+ fi
15
+ docker run -d "$image" "$@"
16
+ ;;
17
+ terminate-instance)
18
+ instance="$1"; shift
19
+ docker stop "$instance"
20
+ ;;
21
+ ssh-info)
22
+ instance="$1"; shift
23
+ echo "$(docker inspect $instance | awk '$1 ~ /IPAddress/ { split($2,ip,"\""); print ip[2] }')" 22
24
+ ;;
25
+ read-state)
26
+ instance="$1"; shift
27
+ echo "$(docker inspect $instance | awk '$1 ~ /Running/ { split($2,state,","); print(state[1] == "true" ? "running" : "not_created") }')"
28
+ ;;
29
+ *)
30
+ exit 1
31
+ ;;
32
+ esac
data/libexec/shell-ec2 ADDED
@@ -0,0 +1,36 @@
1
+ #!/bin/bash -efu
2
+
3
+ if [[ -n "${VAGRANT_LOG:-}" ]]; then
4
+ set -x
5
+ fi
6
+
7
+ : ${AWS_TYPE:=m1.large}
8
+ : ${AWS_REGION:=us-east-1}
9
+ : ${AWS_KEYPAIR:=default}
10
+ : ${AWS_BLOCK:=/dev/sda1=:80}
11
+ : ${AWS_SHUTDOWN:=terminate}
12
+ : ${AWS_QUANTITY:=1}
13
+
14
+ cmd="$1"; shift
15
+ case "$cmd" in
16
+ run-instance)
17
+ image="$1"; shift
18
+ ec2-run-instances -t "$AWS_TYPE" --region "$AWS_REGION" -k "$AWS_KEYPAIR" -b "$AWS_BLOCK" --instance-initiated-shutdown-behavior "$AWS_SHUTDOWN" -n "$AWS_QUANTITY" "$image" | awk '$1 == "INSTANCE" { print $2 }'
19
+ ;;
20
+ terminate-instance)
21
+ instance="$1"; shift
22
+ ec2-terminate-instances "$instance"
23
+ ;;
24
+ ssh-info)
25
+ instance="$1"; shift
26
+ echo "$(ec2-describe-instances "$instance" | awk '$1 == "INSTANCE" && $6 == "running" { print $4 }')" 22
27
+ ;;
28
+ read-state)
29
+ instance="$1"; shift
30
+ ec2-describe-instances "$instance" | awk '$1 == "INSTANCE" { print $6 }'
31
+ ;;
32
+ *)
33
+ exit 1
34
+ ;;
35
+ esac
36
+
@@ -0,0 +1,39 @@
1
+ #!/bin/bash -efu
2
+
3
+ function debug {
4
+ if [[ -n "${VAGRANT_LOG:-}" ]]; then
5
+ printf '[%s]: %s\n' "$(basename $0)" "$*" 1>&2
6
+ fi
7
+ }
8
+
9
+ if [[ -n "${VAGRANT_LOG:-}" ]]; then
10
+ set -x
11
+ fi
12
+
13
+ cmd="$1"; shift
14
+ case "$cmd" in
15
+ run-instance)
16
+ image="$1"; shift
17
+ debug "run-instance $image"
18
+ debug "run-instance args: $* 1>&2"
19
+ echo "$image"
20
+ ;;
21
+ terminate-instance)
22
+ instance="$1"; shift
23
+ debug "terminate-instance $instance"
24
+ ;;
25
+ ssh-info)
26
+ instance="$1"; shift
27
+ debug "ssh-info $instance"
28
+ debug "ssh-info: 127.0.0.1 22"
29
+ echo "${instance} 22"
30
+ ;;
31
+ read-state)
32
+ instance="$1"; shift
33
+ debug "read-state $instance"
34
+ echo "running"
35
+ ;;
36
+ *)
37
+ exit 1
38
+ ;;
39
+ esac
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -38,6 +38,9 @@ files:
38
38
  - lib/vagrant-shell/version.rb
39
39
  - lib/vagrant-shell.rb
40
40
  - locales/en.yml
41
+ - libexec/shell-docker
42
+ - libexec/shell-ec2
43
+ - libexec/shell-static
41
44
  - CHANGELOG.md
42
45
  - LICENSE
43
46
  - README.md