示例#1
0
        public IEnumerable <Ec2Instance> Start()
        {
            var bootstrapId = _options.InstanceRequest.ClientToken;
            IEnumerable <Instance> instances = _instanceHandler.GetInstances(bootstrapId);

            List <Tuple <string, string> > existingPasswords = null;

            if (!_settings.Config.DeploymentUser.IsDefined())
            {
                existingPasswords = _passwordHandler.WaitForPassword(instances.Select(x => x.InstanceId),
                                                                     _options.PrivateKeyFileLocation);
            }

            List <Ec2Instance> ec2instances = new List <Ec2Instance>();

            foreach (var instance in instances)
            {
                ec2instances.Add(new Ec2Instance
                {
                    InstanceId        = instance.InstanceId,
                    UserName          = _settings.Config.DeploymentUser.IsDefined() ? _settings.Config.DeploymentUser.UserName : "******",
                    Password          = _settings.Config.DeploymentUser.IsDefined() ? _settings.Config.DeploymentUser.Password : existingPasswords.Single(x => x.Item1 == instance.InstanceId).Item2,
                    AwsInstance       = instance,
                    ManagementAddress = _instanceHandler.GetManagementAddress(instance)
                });
            }
            _instanceHandler.Start(bootstrapId);

            return(ec2instances);
        }
示例#2
0
 private string GetManagementAddress(Instance instance)
 {
     return(_instanceHandler.GetManagementAddress(instance, _options.ManagementAddressType, _options.NetworkInterfaceValues.RemoteManagementInterfaceIndex));
 }