vagrant-yaybu 0.0.5 → 0.0.6
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.
- data/CHANGES +47 -0
 - data/Vagrantfile +4 -4
 - data/lib/vagrant-yaybu/provisioner.rb +76 -1
 - data/lib/vagrant-yaybu/version.rb +1 -1
 - metadata +4 -3
 
    
        data/CHANGES
    ADDED
    
    | 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Changelog for vagrant-yaybu
         
     | 
| 
      
 2 
     | 
    
         
            +
            ===========================
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            0.0.6 (2012-02-12)
         
     | 
| 
      
 5 
     | 
    
         
            +
            ------------------
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
             - Add an automatically generated ``vagrant`` node accessible from yay. This
         
     | 
| 
      
 8 
     | 
    
         
            +
               can provide details about all your defined VMs:: 
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                   vagrant:
         
     | 
| 
      
 11 
     | 
    
         
            +
                     vms:
         
     | 
| 
      
 12 
     | 
    
         
            +
                       web:
         
     | 
| 
      
 13 
     | 
    
         
            +
                         name: web
         
     | 
| 
      
 14 
     | 
    
         
            +
                         interfaces:
         
     | 
| 
      
 15 
     | 
    
         
            +
                           - name: eth1
         
     | 
| 
      
 16 
     | 
    
         
            +
                             address: 10.33.33.33
         
     | 
| 
      
 17 
     | 
    
         
            +
                             netmask: 255.255.255.0
         
     | 
| 
      
 18 
     | 
    
         
            +
                             gateway: 10.33.33.1
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                           - name: eth0
         
     | 
| 
      
 21 
     | 
    
         
            +
                             type: dhcp
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
               To reference eth1 on the current VM you can use::
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                   ${vagrant.vm.interfaces[0].address}
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
               Unfortunately you won't be able to access the IP address of eth0 presently.
         
     | 
| 
      
 28 
     | 
    
         
            +
               When using vagrant you rarely access the IP directly and have port forwards
         
     | 
| 
      
 29 
     | 
    
         
            +
               to localhost on the host. eth0 will always be the last interface in the list.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
             - The bootstrap functionality will bootstrap the same version of yay and Yaybu
         
     | 
| 
      
 32 
     | 
    
         
            +
               This can be overriden by setting ``yay_version`` and ``yaybu_version`` in
         
     | 
| 
      
 33 
     | 
    
         
            +
               your Vagrantfile.
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            0.0.5 (2012-02-18)
         
     | 
| 
      
 37 
     | 
    
         
            +
            ------------------
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
             - Update to support vagrant 0.9.7+
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            0.0.4 (2012-02-18)
         
     | 
| 
      
 43 
     | 
    
         
            +
            -------------
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
             - Update to support vagrant 0.9+
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
    
        data/Vagrantfile
    CHANGED
    
    | 
         @@ -15,11 +15,11 @@ Vagrant::Config.run do |config| 
     | 
|
| 
       15 
15 
     | 
    
         
             
                # You can add directories and remote locations to the search path
         
     | 
| 
       16 
16 
     | 
    
         
             
                # Both Yay files and assets (templates, etc) will be fetched from here.
         
     | 
| 
       17 
17 
     | 
    
         
             
                # The default search path is the current working directory
         
     | 
| 
       18 
     | 
    
         
            -
                cfg.searchpath << "../Projects/yaybu-configuration/"
         
     | 
| 
       19 
     | 
    
         
            -
                cfg.searchpath << "https://raw.github.com/isotoma/yaybu-examples/master/"
         
     | 
| 
      
 18 
     | 
    
         
            +
                # cfg.searchpath << "../Projects/yaybu-configuration/"
         
     | 
| 
      
 19 
     | 
    
         
            +
                # cfg.searchpath << "https://raw.github.com/isotoma/yaybu-examples/master/"
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                # You can load any config that is on the searchpath
         
     | 
| 
       22 
     | 
    
         
            -
                cfg.include << "configuration/minecraft.yay"
         
     | 
| 
      
 22 
     | 
    
         
            +
                # cfg.include << "configuration/minecraft.yay"
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                # The ``yay`` parameter lets you put arbritrary config inside your Vagrant file
         
     | 
| 
       25 
25 
     | 
    
         
             
                cfg.yay  = <<-EOS
         
     | 
| 
         @@ -31,7 +31,7 @@ Vagrant::Config.run do |config| 
     | 
|
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                # Advanced Yaybu hackers might not want to use the default python or a packaged
         
     | 
| 
       33 
33 
     | 
    
         
             
                # version of Yaybu. You can set this to point at your development environment.
         
     | 
| 
       34 
     | 
    
         
            -
                 
     | 
| 
      
 34 
     | 
    
         
            +
                cfg.python = "/opt/virtualenvs/yaybu/bin/python"
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         
             
            end
         
     | 
| 
         @@ -38,6 +38,10 @@ class opts: 
     | 
|
| 
       38 
38 
     | 
    
         
             
                no_resume = False
         
     | 
| 
       39 
39 
     | 
    
         
             
                env_passthrough = []
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
      
 41 
     | 
    
         
            +
            vagrant_config = StringIO.StringIO("""
         
     | 
| 
      
 42 
     | 
    
         
            +
            <%= vagrant %>
         
     | 
| 
      
 43 
     | 
    
         
            +
            """)
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       41 
45 
     | 
    
         
             
            includes = StringIO.StringIO("""
         
     | 
| 
       42 
46 
     | 
    
         
             
            <% if includes.length > 0 %>
         
     | 
| 
       43 
47 
     | 
    
         
             
            .include:
         
     | 
| 
         @@ -52,6 +56,7 @@ raw_config = StringIO.StringIO(""" 
     | 
|
| 
       52 
56 
     | 
    
         
             
            """)
         
     | 
| 
       53 
57 
     | 
    
         | 
| 
       54 
58 
     | 
    
         
             
            config = Config(searchpath=opts.ypath)
         
     | 
| 
      
 59 
     | 
    
         
            +
            config.load(vagrant_config)
         
     | 
| 
       55 
60 
     | 
    
         
             
            config.load(includes)
         
     | 
| 
       56 
61 
     | 
    
         
             
            config.load(raw_config)
         
     | 
| 
       57 
62 
     | 
    
         | 
| 
         @@ -80,6 +85,8 @@ module Vagrant 
     | 
|
| 
       80 
85 
     | 
    
         
             
                    attr_accessor :python
         
     | 
| 
       81 
86 
     | 
    
         
             
                    attr_accessor :searchpath
         
     | 
| 
       82 
87 
     | 
    
         
             
                    attr_accessor :include
         
     | 
| 
      
 88 
     | 
    
         
            +
                    attr_accessor :yay_version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    attr_accessor :yaybu_version
         
     | 
| 
       83 
90 
     | 
    
         | 
| 
       84 
91 
     | 
    
         
             
                    def initialize
         
     | 
| 
       85 
92 
     | 
    
         
             
                      super
         
     | 
| 
         @@ -88,6 +95,9 @@ module Vagrant 
     | 
|
| 
       88 
95 
     | 
    
         
             
                      @python = "python"
         
     | 
| 
       89 
96 
     | 
    
         
             
                      @searchpath = []
         
     | 
| 
       90 
97 
     | 
    
         
             
                      @include = []
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                      @yay_version = nil
         
     | 
| 
      
 100 
     | 
    
         
            +
                      @yaybu_version = nil
         
     | 
| 
       91 
101 
     | 
    
         
             
                    end
         
     | 
| 
       92 
102 
     | 
    
         
             
                  end
         
     | 
| 
       93 
103 
     | 
    
         | 
| 
         @@ -101,9 +111,26 @@ module Vagrant 
     | 
|
| 
       101 
111 
     | 
    
         
             
                      ssh.sudo("which yaybu", :error_class => YaybuError, :_key => :yaybu_not_detected, :binary => "yaybu")
         
     | 
| 
       102 
112 
     | 
    
         
             
                    rescue
         
     | 
| 
       103 
113 
     | 
    
         
             
                      env[:ui].info "Yaybu not found so attempting to install it"
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                      if not config.yay_version then
         
     | 
| 
      
 116 
     | 
    
         
            +
                          env[:ui].info "yay version not specified in Vagrantfile, determining from host system"
         
     | 
| 
      
 117 
     | 
    
         
            +
                          config.yay_version = get_local_version?("yay")
         
     | 
| 
      
 118 
     | 
    
         
            +
                      end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                      if not config.yaybu_version then
         
     | 
| 
      
 121 
     | 
    
         
            +
                          env[:ui].info "Yaybu version not specified in Vagrantfile, determining from host system"
         
     | 
| 
      
 122 
     | 
    
         
            +
                          config.yaybu_version = get_local_version?("Yaybu")
         
     | 
| 
      
 123 
     | 
    
         
            +
                      end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                      env[:ui].info "Running apt-get updating and checking setuptools"
         
     | 
| 
       104 
126 
     | 
    
         
             
                      ssh.sudo("apt-get update")
         
     | 
| 
       105 
127 
     | 
    
         
             
                      ssh.sudo("apt-get install python-setuptools -y")
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                      env[:ui].info "Running 'easy_install yay==#{config.yay_version}'"
         
     | 
| 
      
 130 
     | 
    
         
            +
                      ssh.sudo("easy_install yay==#{config.yay_version}")
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                      env[:ui].info "Running 'easy_install Yaybu==#{config.yaybu_version}'"
         
     | 
| 
      
 133 
     | 
    
         
            +
                      ssh.sudo("easy_install Yaybu==#{config.yaybu_version}")
         
     | 
| 
       107 
134 
     | 
    
         
             
                    end
         
     | 
| 
       108 
135 
     | 
    
         
             
                  end
         
     | 
| 
       109 
136 
     | 
    
         | 
| 
         @@ -122,6 +149,53 @@ module Vagrant 
     | 
|
| 
       122 
149 
     | 
    
         
             
                      end
         
     | 
| 
       123 
150 
     | 
    
         
             
                  end
         
     | 
| 
       124 
151 
     | 
    
         | 
| 
      
 152 
     | 
    
         
            +
                  def get_local_version?(mod)
         
     | 
| 
      
 153 
     | 
    
         
            +
                      version = `#{config.python} -c 'print __import__("pkg_resources").get_distribution("#{mod}").version'`.strip
         
     | 
| 
      
 154 
     | 
    
         
            +
                      if $?.to_i != 0 then
         
     | 
| 
      
 155 
     | 
    
         
            +
                          raise YaybuError.new "Failed to get host version for '#{mod}'"
         
     | 
| 
      
 156 
     | 
    
         
            +
                      end
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                      version
         
     | 
| 
      
 159 
     | 
    
         
            +
                  end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                  def get_vagrant_yaml?
         
     | 
| 
      
 162 
     | 
    
         
            +
                      data = {}
         
     | 
| 
      
 163 
     | 
    
         
            +
                      vagrant = data['vagrant'] = {}
         
     | 
| 
      
 164 
     | 
    
         
            +
                      vms = vagrant['vms'] = {}
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
                      env[:vm].env.vms.each do |name, vm|
         
     | 
| 
      
 167 
     | 
    
         
            +
                          info = {
         
     | 
| 
      
 168 
     | 
    
         
            +
                              "name" => vm.name.to_s,
         
     | 
| 
      
 169 
     | 
    
         
            +
                              "interfaces" => [],
         
     | 
| 
      
 170 
     | 
    
         
            +
                              }
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                          idx = 1
         
     | 
| 
      
 173 
     | 
    
         
            +
                          vm.config.vm.networks.each do |type, ips|
         
     | 
| 
      
 174 
     | 
    
         
            +
                              ips.each do |ip|
         
     | 
| 
      
 175 
     | 
    
         
            +
                                  info["interfaces"] << {
         
     | 
| 
      
 176 
     | 
    
         
            +
                                      "name" => "eth#{idx}",
         
     | 
| 
      
 177 
     | 
    
         
            +
                                      "address" => ip,
         
     | 
| 
      
 178 
     | 
    
         
            +
                                      "netmask" => "255.255.255.0",
         
     | 
| 
      
 179 
     | 
    
         
            +
                                      "gateway" => (ip.split(".").slice(0, 3) + [1]).join("."),
         
     | 
| 
      
 180 
     | 
    
         
            +
                                      }
         
     | 
| 
      
 181 
     | 
    
         
            +
                                  idx += 1
         
     | 
| 
      
 182 
     | 
    
         
            +
                              end
         
     | 
| 
      
 183 
     | 
    
         
            +
                          end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                          info["interfaces"] << {
         
     | 
| 
      
 186 
     | 
    
         
            +
                              "name" => "eth0",
         
     | 
| 
      
 187 
     | 
    
         
            +
                              "type" => "dhcp",
         
     | 
| 
      
 188 
     | 
    
         
            +
                              }
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
                          vms[name.to_s] = info
         
     | 
| 
      
 191 
     | 
    
         
            +
                      end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
                      name = env[:vm].name.to_s
         
     | 
| 
      
 194 
     | 
    
         
            +
                      vagrant["vm"] = "${vagrant.vms.#{name}}"
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
                      "#" + data.to_yaml
         
     | 
| 
      
 197 
     | 
    
         
            +
                  end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
       125 
199 
     | 
    
         
             
                  def provision!
         
     | 
| 
       126 
200 
     | 
    
         
             
                    verify_import "yaybu"
         
     | 
| 
       127 
201 
     | 
    
         
             
                    verify_import "yay"
         
     | 
| 
         @@ -136,6 +210,7 @@ module Vagrant 
     | 
|
| 
       136 
210 
     | 
    
         
             
                      :ssh_port => env[:vm].ssh.info[:port],
         
     | 
| 
       137 
211 
     | 
    
         
             
                      :private_key_path => env[:vm].ssh.info[:private_key_path],
         
     | 
| 
       138 
212 
     | 
    
         
             
                      :yay => config.yay,
         
     | 
| 
      
 213 
     | 
    
         
            +
                      :vagrant => get_vagrant_yaml?,
         
     | 
| 
       139 
214 
     | 
    
         
             
                      :searchpath => config.searchpath,
         
     | 
| 
       140 
215 
     | 
    
         
             
                      :includes => config.include,
         
     | 
| 
       141 
216 
     | 
    
         
             
                      })
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vagrant-yaybu
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.6
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2012- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-09-20 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       14 
14 
     | 
    
         
             
            description: This plugin adds a Yaybu 'push' provisioner to Vagrant
         
     | 
| 
       15 
15 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -19,6 +19,7 @@ extensions: [] 
     | 
|
| 
       19 
19 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       20 
20 
     | 
    
         
             
            files:
         
     | 
| 
       21 
21 
     | 
    
         
             
            - .gitignore
         
     | 
| 
      
 22 
     | 
    
         
            +
            - CHANGES
         
     | 
| 
       22 
23 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       23 
24 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       24 
25 
     | 
    
         
             
            - Vagrantfile
         
     | 
| 
         @@ -48,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       48 
49 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       49 
50 
     | 
    
         
             
            requirements: []
         
     | 
| 
       50 
51 
     | 
    
         
             
            rubyforge_project: vagrant-yaybu
         
     | 
| 
       51 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 52 
     | 
    
         
            +
            rubygems_version: 1.8.11
         
     | 
| 
       52 
53 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       53 
54 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       54 
55 
     | 
    
         
             
            summary: Teach Vagrant about Yaybu
         
     |