asbestos 0.0.4 → 0.0.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 +8 -8
- data/lib/asbestos/host.rb +6 -6
- data/lib/asbestos/metadata.rb +1 -1
- data/spec/asbestos/host_spec.rb +9 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                ZTRkYjZhMjBhZjc5MTMyOWU0NDA5MTkxZTBmNmYwZGQ4OTUxOTNjNA==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZDdhZjBmMjA4N2E2MTk1YmYwZTQwMDQ4NDQ2NzJkMTFhZDc4MDc5Zg==
         | 
| 7 7 | 
             
            !binary "U0hBNTEy":
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                YzRlNDgwMDA2NjQ1YTZiODk4NzE3MWExMTIwMjg3OWM5Y2EwYzkxOGNiYTE5
         | 
| 10 | 
            +
                NzIwMDljYzY4MGZkNDBhZTkwNzZiNjgyYjkzZmQ5ZmUyMDY2NjRlNGI4OTNj
         | 
| 11 | 
            +
                NTg1ZDIyNjUwMWI1MGI3MzE3ZWIwM2UwMWZhNWRiZWRlMGVjN2M=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                OTUyMWRjMzk5MDU5MDQ2Zjg5YTg5NzFjNmY2NTE0NjMzZTM4MDNlMTYyMTlm
         | 
| 14 | 
            +
                MGNiYTllYzAyOGI5YzUzZDVhOWY5OWMxNjQwNWQ2NTg0MDJiZWVhMTVjMTRk
         | 
| 15 | 
            +
                NzJkMzA5NGZjMGQ4ZTYyZmM2OTQzNjNjZjA0ZDIzZjE0MmIwNjA=
         | 
    
        data/lib/asbestos/host.rb
    CHANGED
    
    | @@ -119,19 +119,19 @@ class Asbestos::Host | |
| 119 119 | 
             
              # end
         | 
| 120 120 | 
             
              #
         | 
| 121 121 | 
             
              def interface(tag, if_names, address = nil, &block)
         | 
| 122 | 
            -
                 | 
| 123 | 
            -
                raise "single address, #{address}, given for multiple interfaces, #{ | 
| 122 | 
            +
                interfaces = [*@interfaces[tag], *if_names].compact
         | 
| 123 | 
            +
                raise "single address, #{address}, given for multiple interfaces, #{interfaces}, on host #{name}" if interfaces.length > 1 && address
         | 
| 124 124 |  | 
| 125 | 
            -
                @interfaces[tag] =  | 
| 125 | 
            +
                @interfaces[tag] = interfaces
         | 
| 126 126 |  | 
| 127 127 | 
             
                # determine the address for each interface
         | 
| 128 | 
            -
                 | 
| 128 | 
            +
                interfaces.each do |if_name|
         | 
| 129 129 | 
             
                  new_address = \
         | 
| 130 130 | 
             
                    if !address
         | 
| 131 131 | 
             
                      if block_given? 
         | 
| 132 132 | 
             
                        yield(self, if_name)
         | 
| 133 133 | 
             
                      else
         | 
| 134 | 
            -
                        if  | 
| 134 | 
            +
                        if interfaces.length > 1
         | 
| 135 135 | 
             
                          "#{name}_#{tag}_#{if_name}"
         | 
| 136 136 | 
             
                        else
         | 
| 137 137 | 
             
                          "#{name}_#{tag}"
         | 
| @@ -140,7 +140,7 @@ class Asbestos::Host | |
| 140 140 | 
             
                    else
         | 
| 141 141 | 
             
                      address
         | 
| 142 142 | 
             
                    end
         | 
| 143 | 
            -
                  @addresses[if_name]  | 
| 143 | 
            +
                  @addresses[if_name] = new_address
         | 
| 144 144 | 
             
                end
         | 
| 145 145 |  | 
| 146 146 | 
             
              end
         | 
    
        data/lib/asbestos/metadata.rb
    CHANGED
    
    
    
        data/spec/asbestos/host_spec.rb
    CHANGED
    
    | @@ -79,6 +79,15 @@ describe Asbestos::Host do | |
| 79 79 | 
             
                    Host['hostname'].call.interfaces[:some_tag].should == [:eth0, :eth1]
         | 
| 80 80 | 
             
                  end
         | 
| 81 81 |  | 
| 82 | 
            +
                  it "should add interfaces to the tag when called more than once" do
         | 
| 83 | 
            +
                    host 'hostname' do
         | 
| 84 | 
            +
                      interface :some_tag, :eth0
         | 
| 85 | 
            +
                      interface :some_tag, :eth1
         | 
| 86 | 
            +
                    end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                    Host['hostname'].call.interfaces[:some_tag].should == [:eth0, :eth1]
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
             | 
| 82 91 | 
             
                  context "generating addresses" do
         | 
| 83 92 | 
             
                    context "defaults" do
         | 
| 84 93 | 
             
                      it "should generate defaults for singular interfaces" do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: asbestos
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Michael Shapiro
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-04-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -158,3 +158,4 @@ test_files: | |
| 158 158 | 
             
            - spec/asbestos/rule_set_spec.rb
         | 
| 159 159 | 
             
            - spec/asbestos/service_spec.rb
         | 
| 160 160 | 
             
            - spec/spec_helper.rb
         | 
| 161 | 
            +
            has_rdoc: 
         |