vagrant-communicator-docker 1.0.7 → 1.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb4aea56e9f2b6c933234e8c76a9bde7721b897639ace97c9d8546d50343d2cd
4
- data.tar.gz: d9bc70a8168645b609d1b5c9ba57e6059180d74969097f1b06bbf0e934741c4f
3
+ metadata.gz: f7ef642fbce92f0ce6e2225ecac4660e3f906551d63b0021446dbdb596e8c840
4
+ data.tar.gz: 26a7589ad4ef448834bd3628e80b8c4dbca7abf4579ac8b7337bf00619e37248
5
5
  SHA512:
6
- metadata.gz: c55d121aca3d826ffbe5f1b6c053a23b3843183056f2e6d9e47755a661d00338c2e35dbb54cc7c21797cb1c6127d6eeb66670a1bb1b2cca807c5944d7477a1c0
7
- data.tar.gz: bd23c04708f136e37381e0ad0d10b7fadf1013188879c94b4111cc83dfe896a690fe512fce035376b72f5136ac7207174f4842ff91db3bdca35792ae7f8e5dc8
6
+ metadata.gz: 311e39e32e0ff405e5647c5512cd89b594df6121b3b52e8731e57fce4beb6f0bfa9699a0de14e5d91c4d3f572c5d9de3cd0832987ed7e0372d5aeffe9a1abd2d
7
+ data.tar.gz: 28a962afb2eeabe69a495e7c958e474cbd7f46e98831d08b0760f1450b08eae912ccbf7d4d9edc6412dbe171228fdc0faf8657c4232df6057cdae02bf5499210
data/README.md CHANGED
@@ -9,13 +9,18 @@ have SSH - They do not.
9
9
  This communicator will make vagrant tasks that require SSH, interact with the docker instances, as if SSH exists, by
10
10
  using the Docker API.
11
11
 
12
+ Shell scripts used during provisioning will also be executed, so will facilitate provisioning shel scripts as well (from 1.0.8).
13
+ Please note that these will always run as root inside the docker instance.
14
+
12
15
  This has only been used in a Linux environment.
13
16
 
14
17
  ## Requirements
15
18
 
16
- * Docker API gem: ```vagrant plugin install docker-api```
19
+ * Docker API gem. Although set as a dependency for the communicator, you *must* install this as a vagrant plugin, else it will not be located to be used by vagrant.
17
20
 
18
- If you get an error noted as: ```undefined method `copy' for...``` please use : ```vagrant plugin install docker-api --plugin-version=1.34.2```
21
+ ```
22
+ vagrant plugin install docker-api
23
+ ```
19
24
 
20
25
  ## Installation
21
26
 
@@ -27,12 +32,9 @@ vagrant plugin install vagrant-communicator-docker
27
32
 
28
33
  ### Manual install
29
34
 
30
- * fetch the built gem package located here: ```https://raw.githubusercontent.com/ProxiBlue/vagrant-communicator-docker/master/communicator-docker-1.0.6.gem```
31
- * install using: ```vagrant plugin install communicator-docker-1.0.6.gem```
35
+ * install using: ```vagrant plugin install vagrant-communicator-docker-[version].gem```
36
+ * install dependency ```vagrant plugin install docker-api``` (must be version 2.0.0 or greater)
32
37
 
33
- ```
34
- curl https://raw.githubusercontent.com/ProxiBlue/vagrant-communicator-docker/master/communicator-docker-1.0.6.gem > communicator-docker-1.0.6.gem
35
- ```
36
38
 
37
39
  ## Usage
38
40
 
@@ -58,10 +60,17 @@ config.vm.define "database", primary: false do |database|
58
60
  end
59
61
  ```
60
62
 
61
- ## Limitations
63
+ ## Communication over TCP with remote Docker
64
+
65
+ By default the communicator connects with Docker over a local socket. You can override this, and allow remote Docker connection by setting an environment variable:
66
+
67
+ ```DOCKER_HOST=tcp://[DOCKER HOST]:[PORT]```
68
+
69
+ example:
70
+
71
+ ```DOCKER_HOST=tcp://127.0.0.1:2375``` vagrant up
62
72
 
63
- Communicates with a local docker service via linux sockets. That is all I need.
64
- Should be able to be extended to include a docker connection string to a tcp connection, but I have no need for that as yet, so not implemented.
73
+ ## Shell
65
74
 
66
75
  The default shell will be /bin/bash inside the docker container. You can override this using : ```vm.communicator.bash_shell = '/bin/sh';``` to use /bin/sh (or any other shell)
67
76
 
data/changelog.md ADDED
@@ -0,0 +1,13 @@
1
+ ## Changelog
2
+
3
+ * 1.0.1: Initial public release
4
+ * 1.0.2: Adjust how command is run via docker api exec call
5
+ * 1.0.3: Add option to set shell to use
6
+ * 1.0.4: Just a version bump to force a new build, no code adjustments
7
+ * 1.0.5: Add shell_wait command to add delay for slow starting dockers
8
+ * 1.0.6: Docker API update how command is run via API: https://github.com/swipely/docker-api/commit/425036dd85e41f8d4e6ea95ee6d001d76af9c7d7
9
+ * 1.0.7: Change name to have 'vagrant-' prefix and push to rybygems
10
+ * 1.0.8: Adjust so provisioning shell scripts get renamed to allow them to execute
11
+ * 1.0.9: Add gemspec dependency
12
+ * 1.1.10: Add stdout response from scripts running
13
+ * 1.1.11: SOme more debug log messages
@@ -13,4 +13,5 @@ Gem::Specification.new do |s|
13
13
  s.require_paths = ['lib']
14
14
  s.homepage = 'https://github.com/ProxiBlue/vagrant-communicator-docker'
15
15
  s.license = 'MIT'
16
+ s.add_dependency 'docker-api', '~> 2.0', '>= 2.0.0'
16
17
  end
@@ -31,6 +31,7 @@ module VagrantPlugins
31
31
  @container = Docker::Container.get(@machineID)
32
32
  @logger.debug(@container.json)
33
33
  # If we reached this point then we successfully connected
34
+ @logger.debug("DOCKER COMMUNICATOR connected to #{@machineID}")
34
35
  true
35
36
  rescue
36
37
  @logger.debug("DOCKER COMMUNICATOR - Could not make connection to #{@machineID}")
@@ -56,6 +57,7 @@ module VagrantPlugins
56
57
  end
57
58
  rescue Timeout::Error
58
59
  # We timed out, we failed.
60
+ @logger.debug("DOCKER COMMUNICATOR - Timeout to ready")
59
61
  end
60
62
 
61
63
  return false
@@ -89,8 +91,11 @@ module VagrantPlugins
89
91
  # @param [String] to Path of where to save the file on the remote
90
92
  # machine.
91
93
  def upload(from, to)
92
- @logger.debug("DOCKER COMMUNICATOR - upload from: #{from} to: #{to}")
94
+ to_folder = File.dirname(to)
95
+ from_filename = File.basename(from)
96
+ @logger.debug("DOCKER COMMUNICATOR - upload from: #{from} to: #{to_folder} from_filename: #{from_filename}")
93
97
  @container.archive_in(from, File.dirname(to), overwrite: true)
98
+ execute("mv #{to_folder}/#{from_filename} #{to}")
94
99
  end
95
100
 
96
101
  # Execute a command on the remote machine. The exact semantics
@@ -109,13 +114,20 @@ module VagrantPlugins
109
114
  # @return [Integer] Exit code of the command.
110
115
  def execute(command, opts=nil)
111
116
  begin
117
+ @logger.debug("DOCKER COMMUNICATOR - EXECUTE: #{command}")
112
118
  wait_for_ready(@machine.config.communicator.bash_wait)
113
- result = @container.exec([@machine.config.communicator.bash_shell, '-c' , command], stderr: false)
119
+ @logger.debug("DOCKER COMMUNICATOR - Ready to EXECUTE")
120
+ result = @container.exec([@machine.config.communicator.bash_shell, '-c' , command], tty: true)
114
121
  @logger.debug(result)
115
- @logger.debug(result.last)
122
+ if result.first.length > 0
123
+ result.first.first.each_line do |line|
124
+ yield :stdout, line if block_given?
125
+ end
126
+ end
116
127
  return result.last
117
- rescue
118
- @logger.info("Error running command " + command + " on guest using shell #{@machine.config.communicator.bash_shell}")
128
+ rescue => e
129
+ @logger.info("DOCKER COMMUNICATOR: Error running command " + command + " on guest using shell #{@machine.config.communicator.bash_shell}")
130
+ @logger.error ([e.message]+e.backtrace).join($/)
119
131
  end
120
132
  return 255
121
133
  end
@@ -137,7 +149,7 @@ module VagrantPlugins
137
149
  #
138
150
  # @see #execute
139
151
  def test(command, opts=nil)
140
- result = execute(command, opts)
152
+ result = execute(command)
141
153
  if result == 0
142
154
  return true
143
155
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VagrantCommunicatorDocker
3
- VERSION = '1.0.7'
3
+ VERSION = '1.0.11'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-communicator-docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas van Staden
@@ -9,7 +9,27 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-11-01 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: docker-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
13
33
  description: Simulate SSH using Docket API when provisioning vagrant machines that
14
34
  use docker images without SSH
15
35
  email: sales@proxiblue.com.au
@@ -22,14 +42,7 @@ files:
22
42
  - LICENSE.txt
23
43
  - README.md
24
44
  - Rakefile
25
- - communicator-docker-0.0.1.gem
26
- - communicator-docker-1.0.0.gem
27
- - communicator-docker-1.0.1.gem
28
- - communicator-docker-1.0.2.gem
29
- - communicator-docker-1.0.3.gem
30
- - communicator-docker-1.0.4.gem
31
- - communicator-docker-1.0.5.gem
32
- - communicator-docker-1.0.6.gem
45
+ - changelog.md
33
46
  - communicator-docker.gemspec
34
47
  - lib/vagrant-communicator-docker.rb
35
48
  - lib/vagrant-communicator-docker/config.rb
Binary file
Binary file
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file