vagrant-goodhosts 1.0.2 → 1.0.3
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/lib/vagrant-goodhosts/GoodHosts.rb +15 -10
 - data/lib/vagrant-goodhosts/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 14f2491ca0ba5cd0b97ed3cba9cdb6d0bd53264424bd99e7f332f4f5a5c33478
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a86835472ca8dedb943669bfbcae46ffd4a98bcbe317fa3e2b7db4ad9ca2dcd8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e5b067114de507eca9cce70bfc5e0b04ba9913ec0f864d0e50224d9a2ff55ba4b0a77d6d58e0849901584ef462e62882df37206c6d70c3ca4e9bad036afd3a6f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d69cb0b9c0aa641af51cf5c13eb6aa335fa7580e312bfb275286978b32bbed3864a6884d0f88c3bad2e0b773cbaeec80a25ce7d9051ab260544676da69fa3031
         
     | 
| 
         @@ -36,12 +36,13 @@ module VagrantPlugins 
     | 
|
| 
       36 
36 
     | 
    
         
             
                        end
         
     | 
| 
       37 
37 
     | 
    
         
             
                      end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                       
     | 
| 
      
 39 
     | 
    
         
            +
                      
         
     | 
| 
       40 
40 
     | 
    
         
             
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                    return ips
         
     | 
| 
       41 
42 
     | 
    
         
             
                  end
         
     | 
| 
       42 
43 
     | 
    
         | 
| 
       43 
44 
     | 
    
         
             
                  # https://stackoverflow.com/a/13586108/1902215
         
     | 
| 
       44 
     | 
    
         
            -
                  def  
     | 
| 
      
 45 
     | 
    
         
            +
                  def get_os_binary
         
     | 
| 
       45 
46 
     | 
    
         
             
                    return os ||= (host_os = RbConfig::CONFIG["host_os"]
         
     | 
| 
       46 
47 
     | 
    
         
             
                             case host_os
         
     | 
| 
       47 
48 
     | 
    
         
             
                           when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
         
     | 
| 
         @@ -56,9 +57,9 @@ module VagrantPlugins 
     | 
|
| 
       56 
57 
     | 
    
         
             
                  end
         
     | 
| 
       57 
58 
     | 
    
         | 
| 
       58 
59 
     | 
    
         
             
                  def get_cli
         
     | 
| 
       59 
     | 
    
         
            -
                     
     | 
| 
      
 60 
     | 
    
         
            +
                    binary = get_os_binary
         
     | 
| 
       60 
61 
     | 
    
         
             
                    path = File.expand_path(File.dirname(File.dirname(__FILE__))) + "/vagrant-goodhosts/bundle/"
         
     | 
| 
       61 
     | 
    
         
            -
                    path = "#{path}#{ 
     | 
| 
      
 62 
     | 
    
         
            +
                    path = "#{path}#{binary}"
         
     | 
| 
       62 
63 
     | 
    
         | 
| 
       63 
64 
     | 
    
         
             
                    return path
         
     | 
| 
       64 
65 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -99,9 +100,9 @@ module VagrantPlugins 
     | 
|
| 
       99 
100 
     | 
    
         
             
                    hostnames_by_ips = generateHostnamesByIps
         
     | 
| 
       100 
101 
     | 
    
         
             
                    hostnames_by_ips.each do |hostnames, ip_address|
         
     | 
| 
       101 
102 
     | 
    
         
             
                      if cli.include? ".exe"
         
     | 
| 
       102 
     | 
    
         
            -
                        stdin, stdout, stderr, wait_thr = Open3.popen3(cli, " 
     | 
| 
      
 103 
     | 
    
         
            +
                        stdin, stdout, stderr, wait_thr = Open3.popen3(cli, "add", ip_address, hostnames)
         
     | 
| 
       103 
104 
     | 
    
         
             
                      else
         
     | 
| 
       104 
     | 
    
         
            -
                        stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, " 
     | 
| 
      
 105 
     | 
    
         
            +
                        stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, "add", ip_address, hostnames)
         
     | 
| 
       105 
106 
     | 
    
         
             
                      end
         
     | 
| 
       106 
107 
     | 
    
         
             
                      if !wait_thr.value.success?
         
     | 
| 
       107 
108 
     | 
    
         
             
                        error = true
         
     | 
| 
         @@ -117,10 +118,14 @@ module VagrantPlugins 
     | 
|
| 
       117 
118 
     | 
    
         
             
                    cli = get_cli
         
     | 
| 
       118 
119 
     | 
    
         
             
                    hostnames_by_ips = generateHostnamesByIps
         
     | 
| 
       119 
120 
     | 
    
         
             
                    hostnames_by_ips.each do |hostnames, ip_address|
         
     | 
| 
      
 121 
     | 
    
         
            +
                      if !ip_address.nil?
         
     | 
| 
      
 122 
     | 
    
         
            +
                        @ui.error "[vagrant-goodhosts] Error adding some hosts, no IP was provided for the following hostnames: #{hostnames}"
         
     | 
| 
      
 123 
     | 
    
         
            +
                        next
         
     | 
| 
      
 124 
     | 
    
         
            +
                      end
         
     | 
| 
       120 
125 
     | 
    
         
             
                      if cli.include? ".exe"
         
     | 
| 
       121 
     | 
    
         
            -
                        stdin, stdout, stderr, wait_thr = Open3.popen3(cli, " 
     | 
| 
      
 126 
     | 
    
         
            +
                        stdin, stdout, stderr, wait_thr = Open3.popen3(cli, "remove", ip_address, hostnames)
         
     | 
| 
       122 
127 
     | 
    
         
             
                      else
         
     | 
| 
       123 
     | 
    
         
            -
                        stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, " 
     | 
| 
      
 128 
     | 
    
         
            +
                        stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, "remove", ip_address, hostnames)
         
     | 
| 
       124 
129 
     | 
    
         
             
                      end
         
     | 
| 
       125 
130 
     | 
    
         
             
                      if !wait_thr.value.success?
         
     | 
| 
       126 
131 
     | 
    
         
             
                        error = true
         
     | 
| 
         @@ -153,7 +158,7 @@ module VagrantPlugins 
     | 
|
| 
       153 
158 
     | 
    
         
             
                        ip_address = ip
         
     | 
| 
       154 
159 
     | 
    
         
             
                        hostnames[ip].each do |hostname|
         
     | 
| 
       155 
160 
     | 
    
         
             
                          if !ip_address.nil?
         
     | 
| 
       156 
     | 
    
         
            -
                            @ui.info "[vagrant-goodhosts] -  
     | 
| 
      
 161 
     | 
    
         
            +
                            @ui.info "[vagrant-goodhosts] - removing entry for: #{ip_address} #{hostname}"
         
     | 
| 
       157 
162 
     | 
    
         
             
                          end
         
     | 
| 
       158 
163 
     | 
    
         
             
                        end
         
     | 
| 
       159 
164 
     | 
    
         
             
                        hostnames_by_ips = { ip_address => hostnames[ip].join(" ") }
         
     | 
| 
         @@ -162,7 +167,7 @@ module VagrantPlugins 
     | 
|
| 
       162 
167 
     | 
    
         
             
                      ip_address = ips[0]
         
     | 
| 
       163 
168 
     | 
    
         
             
                      hostnames[ip_address].each do |hostname|
         
     | 
| 
       164 
169 
     | 
    
         
             
                        if !ip_address.nil?
         
     | 
| 
       165 
     | 
    
         
            -
                          @ui.info "[vagrant-goodhosts] -  
     | 
| 
      
 170 
     | 
    
         
            +
                          @ui.info "[vagrant-goodhosts] - removing entry for: #{ip_address} #{hostname}"
         
     | 
| 
       166 
171 
     | 
    
         
             
                        end
         
     | 
| 
       167 
172 
     | 
    
         
             
                      end
         
     | 
| 
       168 
173 
     | 
    
         
             
                      hostnames_by_ips = { ip_address => hostnames[ip_address].join(" ") }
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vagrant-goodhosts
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Daniele Scasciafratte
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-08-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |