mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Added win_deploy_auth_retries and win_deploy_auth_retry_delay for ec2 cloud
This commit is contained in:
parent
c2ca579906
commit
883e4d1d1a
@ -46,6 +46,12 @@ parameters are discussed in more detail below.
|
||||
#
|
||||
ssh_interface: public_ips
|
||||
|
||||
# Optionally configure the Windows credential validation number of
|
||||
# retries and delay between retries. This defaults to 10 retries
|
||||
# with a one second delay betwee retries
|
||||
win_deploy_auth_retries: 10
|
||||
win_deploy_auth_retry_delay: 1
|
||||
|
||||
# Set the EC2 access credentials (see below)
|
||||
#
|
||||
id: HJGRYCILJLKJYG
|
||||
@ -95,6 +101,12 @@ parameters are discussed in more detail below.
|
||||
#
|
||||
ssh_interface: private_ips
|
||||
|
||||
# Optionally configure the Windows credential validation number of
|
||||
# retries and delay between retries. This defaults to 10 retries
|
||||
# with a one second delay betwee retries
|
||||
win_deploy_auth_retries: 10
|
||||
win_deploy_auth_retry_delay: 1
|
||||
|
||||
# Set the EC2 access credentials (see below)
|
||||
#
|
||||
id: HJGRYCILJLKJYG
|
||||
@ -141,6 +153,16 @@ Keys tab. The ``id`` setting is labeled Access Key ID, and the ``key`` setting
|
||||
is labeled Secret Access Key.
|
||||
|
||||
|
||||
Windows Deploy Timeouts
|
||||
=======================
|
||||
For Windows instances, it may take longer than normal for the instance to be
|
||||
ready. In these circumstances, the provider configuration can be configured
|
||||
with a ``win_deploy_auth_retries`` and/or a ``win_deploy_auth_retry_delay``
|
||||
setting, which default to 10 retries and a one second delay between retries.
|
||||
These retries and timeouts relate to validating the Administrator password
|
||||
once AWS provides the credentials via the AWS API.
|
||||
|
||||
|
||||
Key Pairs
|
||||
=========
|
||||
In order to create an instance with Salt installed and configured, a key pair
|
||||
|
@ -116,6 +116,15 @@ deploy script (bootstrap-salt.sh, by default) will be run, which will
|
||||
auto-detect the operating system, and install Salt using its native package
|
||||
manager. These do not need to be handled by the developer in the cloud module.
|
||||
|
||||
The ``salt.utils.cloud.validate_windows_cred()`` function has been extended to
|
||||
take the number of retries and retry_delay parameters in case a specific cloud
|
||||
provider has a delay between providing the Windows credentials and the
|
||||
credentials being available for use. In their ``create()`` function, or as a
|
||||
a sub-function called during the creation process, developers should use the
|
||||
``win_deploy_auth_retries`` and ``win_deploy_auth_retry_delay`` parameters from
|
||||
the provider configuration to allow the end-user the ability to customize the
|
||||
number of tries and delay between tries for their particular provider.
|
||||
|
||||
After the appropriate deploy function completes, a final event is fired
|
||||
which describes the virtual machine that has just been created. This event is
|
||||
tagged ``salt/cloud/<vm name>/created``. The payload contains the names of the
|
||||
|
@ -1918,6 +1918,12 @@ def wait_for_instance(
|
||||
win_passwd = config.get_cloud_config_value(
|
||||
'win_password', vm_, __opts__, default=''
|
||||
)
|
||||
win_deploy_auth_retries = config.get_cloud_config_value(
|
||||
'win_deploy_auth_retries', vm_, __opts__, default='10'
|
||||
)
|
||||
win_deploy_auth_retry_delay = config.get_cloud_config_value(
|
||||
'win_deploy_auth_retry_delay', vm_, __opts__, default='1'
|
||||
)
|
||||
if win_passwd and win_passwd == 'auto':
|
||||
log.debug('Waiting for auto-generated Windows EC2 password')
|
||||
while True:
|
||||
@ -1946,7 +1952,9 @@ def wait_for_instance(
|
||||
)
|
||||
if not salt.utils.cloud.validate_windows_cred(ip_address,
|
||||
username,
|
||||
win_passwd):
|
||||
win_passwd,
|
||||
retries=win_deploy_auth_retries,
|
||||
retry_delay=win_deploy_auth_retry_delay):
|
||||
raise SaltCloudSystemExit(
|
||||
'Failed to authenticate against remote windows host'
|
||||
)
|
||||
|
@ -700,7 +700,8 @@ def wait_for_winexesvc(host, port, username, password, timeout=900):
|
||||
)
|
||||
|
||||
|
||||
def validate_windows_cred(host, username='Administrator', password=None, retries=10):
|
||||
def validate_windows_cred(host, username='Administrator', password=None, retries=10,
|
||||
retry_delay=1):
|
||||
'''
|
||||
Check if the windows credentials are valid
|
||||
'''
|
||||
@ -710,7 +711,7 @@ def validate_windows_cred(host, username='Administrator', password=None, retries
|
||||
))
|
||||
if retcode == 0:
|
||||
break
|
||||
time.sleep(1)
|
||||
time.sleep(delay)
|
||||
return retcode == 0
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user