vagrant-mcs 0.8.3 → 0.8.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 +4 -4
- data/lib/vagrant-mcs/action/read_ssh_info.rb +5 -4
- data/lib/vagrant-mcs/action/run_instance.rb +44 -47
- data/lib/vagrant-mcs/version.rb +1 -1
- data/vagrant-mcs-0.8.4.gem +0 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bfd19155ec841939dae2bfe5a0d0aa973933483a
         | 
| 4 | 
            +
              data.tar.gz: ef3d78b6e99317d4529691a03225db4abfa018b1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f9c5dfc0657efaef5499a598c9231a359f319918b0982dbb3df2e68097e585949030860566c9a68a0dd7a31aaf118aa53ffc8ef15d38413aca91f6d25aae081e
         | 
| 7 | 
            +
              data.tar.gz: 12a3793b9a97dd3648cbebf9bce945d44b8629ddd9f51022d58ea0fcb4be643307d20b2637c4b61ce6ee980edd0cb765df031622b890f6cbe07cd7b2311b238a
         | 
| @@ -21,6 +21,7 @@ module VagrantPlugins | |
| 21 21 | 
             
                      return nil if machine.id.nil?
         | 
| 22 22 |  | 
| 23 23 | 
             
                      # Find the machine
         | 
| 24 | 
            +
                      puts "machine id: #{machine.id}"
         | 
| 24 25 | 
             
                      server = mcs.describe_instances(machine.id)
         | 
| 25 26 | 
             
                      #server = mcs.servers.get(machine.id)
         | 
| 26 27 | 
             
                      if server.nil?
         | 
| @@ -46,14 +47,14 @@ module VagrantPlugins | |
| 46 47 | 
             
                          @logger.info("SSH host attribute not found #{attr_name}")
         | 
| 47 48 | 
             
                        end
         | 
| 48 49 | 
             
                      end
         | 
| 49 | 
            -
                      puts 2
         | 
| 50 | 
            +
                      #puts 2
         | 
| 50 51 |  | 
| 51 52 | 
             
                      if !host_value
         | 
| 52 53 | 
             
                        host_value = server["ipAddresses"]
         | 
| 53 54 | 
             
                      end
         | 
| 54 | 
            -
                      puts server["ipAddresses"]
         | 
| 55 | 
            -
                      puts host_value
         | 
| 56 | 
            -
                      puts 3
         | 
| 55 | 
            +
                      #puts server["ipAddresses"]
         | 
| 56 | 
            +
                      #puts host_value
         | 
| 57 | 
            +
                      #puts 3
         | 
| 57 58 | 
             
                      return {:host => host_value, :port => 22}
         | 
| 58 59 | 
             
                    end
         | 
| 59 60 | 
             
                  end
         | 
| @@ -13,7 +13,7 @@ module VagrantPlugins | |
| 13 13 | 
             
                    include Vagrant::Util::Retryable
         | 
| 14 14 |  | 
| 15 15 | 
             
                    def initialize(app, env)
         | 
| 16 | 
            -
                      @app | 
| 16 | 
            +
                      @app = app
         | 
| 17 17 | 
             
                      @logger = Log4r::Logger.new("vagrant_mcs::action::run_instance")
         | 
| 18 18 | 
             
                    end
         | 
| 19 19 |  | 
| @@ -25,24 +25,24 @@ module VagrantPlugins | |
| 25 25 | 
             
                      region = env[:machine].provider_config.region
         | 
| 26 26 |  | 
| 27 27 | 
             
                      # Get the configs
         | 
| 28 | 
            -
                      region_config | 
| 29 | 
            -
                      ami | 
| 30 | 
            -
                      availability_zone | 
| 31 | 
            -
                      instance_type | 
| 32 | 
            -
                      keypair | 
| 33 | 
            -
                      private_ip_address | 
| 34 | 
            -
                      security_groups | 
| 35 | 
            -
                      subnet_id | 
| 36 | 
            -
                      tags | 
| 37 | 
            -
                      user_data | 
| 38 | 
            -
                      block_device_mapping | 
| 39 | 
            -
                      elastic_ip | 
| 28 | 
            +
                      region_config = env[:machine].provider_config.get_region_config(region)
         | 
| 29 | 
            +
                      ami = region_config.ami
         | 
| 30 | 
            +
                      availability_zone = region_config.availability_zone
         | 
| 31 | 
            +
                      instance_type = region_config.instance_type
         | 
| 32 | 
            +
                      keypair = region_config.keypair_name
         | 
| 33 | 
            +
                      private_ip_address = region_config.private_ip_address
         | 
| 34 | 
            +
                      security_groups = region_config.security_groups
         | 
| 35 | 
            +
                      subnet_id = region_config.subnet_id
         | 
| 36 | 
            +
                      tags = region_config.tags
         | 
| 37 | 
            +
                      user_data = region_config.user_data
         | 
| 38 | 
            +
                      block_device_mapping = region_config.block_device_mapping
         | 
| 39 | 
            +
                      elastic_ip = region_config.elastic_ip
         | 
| 40 40 | 
             
                      terminate_on_shutdown = region_config.terminate_on_shutdown
         | 
| 41 | 
            -
                      iam_instance_profile_arn | 
| 41 | 
            +
                      iam_instance_profile_arn = region_config.iam_instance_profile_arn
         | 
| 42 42 | 
             
                      iam_instance_profile_name = region_config.iam_instance_profile_name
         | 
| 43 | 
            -
                      monitoring | 
| 44 | 
            -
                      ebs_optimized | 
| 45 | 
            -
                      associate_public_ip | 
| 43 | 
            +
                      monitoring = region_config.monitoring
         | 
| 44 | 
            +
                      ebs_optimized = region_config.ebs_optimized
         | 
| 45 | 
            +
                      associate_public_ip = region_config.associate_public_ip
         | 
| 46 46 |  | 
| 47 47 | 
             
                      # If there is no keypair then warn the user
         | 
| 48 48 | 
             
                      if !keypair
         | 
| @@ -76,21 +76,21 @@ module VagrantPlugins | |
| 76 76 | 
             
                      env[:ui].info(" -- Assigning a public IP address in a VPC: #{associate_public_ip}")
         | 
| 77 77 |  | 
| 78 78 | 
             
                      options = {
         | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 79 | 
            +
                          :availability_zone => availability_zone,
         | 
| 80 | 
            +
                          :flavor_id => instance_type,
         | 
| 81 | 
            +
                          :image_id => ami,
         | 
| 82 | 
            +
                          :key_name => keypair,
         | 
| 83 | 
            +
                          :private_ip_address => private_ip_address,
         | 
| 84 | 
            +
                          :subnet_id => subnet_id,
         | 
| 85 | 
            +
                          :iam_instance_profile_arn => iam_instance_profile_arn,
         | 
| 86 | 
            +
                          :iam_instance_profile_name => iam_instance_profile_name,
         | 
| 87 | 
            +
                          :tags => tags,
         | 
| 88 | 
            +
                          :user_data => user_data,
         | 
| 89 | 
            +
                          :block_device_mapping => block_device_mapping,
         | 
| 90 | 
            +
                          :instance_initiated_shutdown_behavior => terminate_on_shutdown == true ? "terminate" : nil,
         | 
| 91 | 
            +
                          :monitoring => monitoring,
         | 
| 92 | 
            +
                          :ebs_optimized => ebs_optimized,
         | 
| 93 | 
            +
                          :associate_public_ip => associate_public_ip
         | 
| 94 94 | 
             
                      }
         | 
| 95 95 | 
             
                      if !security_groups.empty?
         | 
| 96 96 | 
             
                        security_group_key = options[:subnet_id].nil? ? :groups : :security_group_ids
         | 
| @@ -101,10 +101,7 @@ module VagrantPlugins | |
| 101 101 | 
             
                      begin
         | 
| 102 102 | 
             
                        # todo
         | 
| 103 103 | 
             
                        server = env[:mcs_compute].create_instance('fa1026fe-c082-4ead-8458-802bf65ca64c', 'C1_M1', nil, nil, nil, datadisk=9, bandwidth=2)
         | 
| 104 | 
            -
             | 
| 105 | 
            -
                        puts server
         | 
| 106 | 
            -
                        puts 'creating finished'
         | 
| 107 | 
            -
                        #server = env[:mcs_compute].servers.create(options)
         | 
| 104 | 
            +
                          #server = env[:mcs_compute].servers.create(options)
         | 
| 108 105 | 
             
                      rescue Exception => e
         | 
| 109 106 | 
             
                        raise Errors::FogError, :message
         | 
| 110 107 | 
             
            =begin
         | 
| @@ -149,7 +146,7 @@ module VagrantPlugins | |
| 149 146 |  | 
| 150 147 | 
             
                          # Notify the user
         | 
| 151 148 | 
             
                          raise Errors::InstanceReadyTimeout,
         | 
| 152 | 
            -
             | 
| 149 | 
            +
                                timeout: region_config.instance_ready_timeout
         | 
| 153 150 | 
             
                        end
         | 
| 154 151 | 
             
                      end
         | 
| 155 152 |  | 
| @@ -196,14 +193,14 @@ module VagrantPlugins | |
| 196 193 |  | 
| 197 194 | 
             
                    def allows_ssh_port?(env, test_sec_groups, is_vpc)
         | 
| 198 195 | 
             
                      port = 22 # TODO get ssh_info port
         | 
| 199 | 
            -
                      test_sec_groups = [ | 
| 200 | 
            -
             | 
| 196 | 
            +
                      test_sec_groups = ["default"] if test_sec_groups.empty? # MCS default security group
         | 
| 197 | 
            +
                                # filter groups by name or group_id (vpc)
         | 
| 201 198 | 
             
                      groups = test_sec_groups.map do |tsg|
         | 
| 202 199 | 
             
                        env[:mcs_compute].security_groups.all.select { |sg| tsg == (is_vpc ? sg.group_id : sg.name) }
         | 
| 203 200 | 
             
                      end.flatten
         | 
| 204 | 
            -
             | 
| 201 | 
            +
                                # filter TCP rules
         | 
| 205 202 | 
             
                      rules = groups.map { |sg| sg.ip_permissions.select { |r| r["ipProtocol"] == "tcp" } }.flatten
         | 
| 206 | 
            -
             | 
| 203 | 
            +
                                # test if any range includes port
         | 
| 207 204 | 
             
                      !rules.select { |r| (r["fromPort"]..r["toPort"]).include?(port) }.empty?
         | 
| 208 205 | 
             
                    end
         | 
| 209 206 |  | 
| @@ -236,7 +233,7 @@ module VagrantPlugins | |
| 236 233 | 
             
                        else
         | 
| 237 234 | 
             
                          association = env[:mcs_compute].associate_address(server.id, nil, nil, allocation.body['allocationId'])
         | 
| 238 235 | 
             
                          # Only store release data for an allocated address
         | 
| 239 | 
            -
                          h = { | 
| 236 | 
            +
                          h = {:allocation_id => allocation.body['allocationId'], :association_id => association.body['associationId'], :public_ip => allocation.body['publicIp']}
         | 
| 240 237 | 
             
                        end
         | 
| 241 238 | 
             
                      else
         | 
| 242 239 | 
             
                        # Standard EC2 instances only need the allocated IP address
         | 
| @@ -244,7 +241,7 @@ module VagrantPlugins | |
| 244 241 | 
             
                          association = env[:mcs_compute].associate_address(server.id, address.public_ip)
         | 
| 245 242 | 
             
                        else
         | 
| 246 243 | 
             
                          association = env[:mcs_compute].associate_address(server.id, allocation.body['publicIp'])
         | 
| 247 | 
            -
                          h = { | 
| 244 | 
            +
                          h = {:public_ip => allocation.body['publicIp']}
         | 
| 248 245 | 
             
                        end
         | 
| 249 246 | 
             
                      end
         | 
| 250 247 |  | 
| @@ -252,11 +249,11 @@ module VagrantPlugins | |
| 252 249 | 
             
                        @logger.debug("Could not associate Elastic IP.")
         | 
| 253 250 | 
             
                        terminate(env)
         | 
| 254 251 | 
             
                        raise Errors::FogError,
         | 
| 255 | 
            -
             | 
| 252 | 
            +
                              :message => "Could not allocate Elastic IP."
         | 
| 256 253 | 
             
                      end
         | 
| 257 254 |  | 
| 258 255 | 
             
                      # Save this IP to the data dir so it can be released when the instance is destroyed
         | 
| 259 | 
            -
                      if h | 
| 256 | 
            +
                      if h
         | 
| 260 257 | 
             
                        ip_file = env[:machine].data_dir.join('elastic_ip')
         | 
| 261 258 | 
             
                        ip_file.open('w+') do |f|
         | 
| 262 259 | 
             
                          f.write(h.to_json)
         | 
| @@ -264,11 +261,11 @@ module VagrantPlugins | |
| 264 261 | 
             
                      end
         | 
| 265 262 | 
             
                    end
         | 
| 266 263 |  | 
| 267 | 
            -
                    def handle_elastic_ip_error(env, message) | 
| 264 | 
            +
                    def handle_elastic_ip_error(env, message)
         | 
| 268 265 | 
             
                      @logger.debug(message)
         | 
| 269 266 | 
             
                      terminate(env)
         | 
| 270 267 | 
             
                      raise Errors::FogError,
         | 
| 271 | 
            -
             | 
| 268 | 
            +
                            :message => message
         | 
| 272 269 | 
             
                    end
         | 
| 273 270 |  | 
| 274 271 | 
             
                    def terminate(env)
         | 
    
        data/lib/vagrant-mcs/version.rb
    CHANGED
    
    
| Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vagrant-mcs
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.8. | 
| 4 | 
            +
              version: 0.8.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - yangchangsheng
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-01- | 
| 11 | 
            +
            date: 2015-01-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: fog
         | 
| @@ -145,6 +145,7 @@ files: | |
| 145 145 | 
             
            - spec/vagrant-aws/config_spec.rb
         | 
| 146 146 | 
             
            - templates/metadata.json.erb
         | 
| 147 147 | 
             
            - templates/vagrant-aws_package_Vagrantfile.erb
         | 
| 148 | 
            +
            - vagrant-mcs-0.8.4.gem
         | 
| 148 149 | 
             
            - vagrant-mcs.gemspec
         | 
| 149 150 | 
             
            homepage: http://www.vagrantup.com
         | 
| 150 151 | 
             
            licenses:
         |