summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--cloud/amazon/ec2.py6
-rw-r--r--cloud/amazon/ec2_vpc.py4
-rw-r--r--files/unarchive.py11
-rw-r--r--network/basics/get_url.py7
-rw-r--r--windows/win_user.ps112
6 files changed, 27 insertions, 15 deletions
diff --git a/VERSION b/VERSION
index efcaa9fc..2f49d40f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.2.0 0.1.rc1
+2.1.2.0 0.2.rc2
diff --git a/cloud/amazon/ec2.py b/cloud/amazon/ec2.py
index 0b660e0d..2abd95e3 100644
--- a/cloud/amazon/ec2.py
+++ b/cloud/amazon/ec2.py
@@ -1279,12 +1279,12 @@ def startstop_instances(module, ec2, instance_ids, state, instance_tags):
# Check that our instances are not in the state we want to take
# Check (and eventually change) instances attributes and instances state
- running_instances_array = []
+ existing_instances_array = []
for res in ec2.get_all_instances(instance_ids, filters=filters):
for inst in res.instances:
# Check "source_dest_check" attribute
- if inst.get_attribute('sourceDestCheck')['sourceDestCheck'] != source_dest_check:
+ if inst.vpc_id is not None and inst.get_attribute('sourceDestCheck')['sourceDestCheck'] != source_dest_check:
inst.modify_attribute('sourceDestCheck', source_dest_check)
changed = True
@@ -1304,7 +1304,9 @@ def startstop_instances(module, ec2, instance_ids, state, instance_tags):
except EC2ResponseError, e:
module.fail_json(msg='Unable to change state for instance {0}, error: {1}'.format(inst.id, e))
changed = True
+ existing_instances_array.append(inst.id)
+ instance_ids = list(set(existing_instances_array + (instance_ids or [])))
## Wait for all the instances to finish starting or stopping
wait_timeout = time.time() + wait_timeout
while wait and wait_timeout > time.time():
diff --git a/cloud/amazon/ec2_vpc.py b/cloud/amazon/ec2_vpc.py
index e0575594..6f52d917 100644
--- a/cloud/amazon/ec2_vpc.py
+++ b/cloud/amazon/ec2_vpc.py
@@ -408,7 +408,7 @@ def create_vpc(module, vpc_conn):
for subnet in subnets:
add_subnet = True
subnet_tags_current = True
- new_subnet_tags = subnet.get('resource_tags', None)
+ new_subnet_tags = subnet.get('resource_tags', {})
subnet_tags_delete = []
for csn in current_subnets:
@@ -444,7 +444,7 @@ def create_vpc(module, vpc_conn):
if add_subnet:
try:
new_subnet = vpc_conn.create_subnet(vpc.id, subnet['cidr'], subnet.get('az', None))
- new_subnet_tags = subnet.get('resource_tags', None)
+ new_subnet_tags = subnet.get('resource_tags', {})
if new_subnet_tags:
# Sometimes AWS takes its time to create a subnet and so using new subnets's id
# to create tags results in exception.
diff --git a/files/unarchive.py b/files/unarchive.py
index 3e11d837..143246a6 100644
--- a/files/unarchive.py
+++ b/files/unarchive.py
@@ -312,7 +312,7 @@ class ZipArchive(object):
version = pcs[1]
ostype = pcs[2]
size = int(pcs[3])
- path = pcs[7]
+ path = unicode(pcs[7], 'utf-8')
# Skip excluded files
if path in self.excludes:
@@ -550,7 +550,7 @@ class TgzArchive(object):
if self.excludes:
cmd += ' --exclude="' + '" --exclude="'.join(self.excludes) + '"'
cmd += ' -f "%s"' % self.src
- rc, out, err = self.module.run_command(cmd)
+ rc, out, err = self.module.run_command(cmd, environ_update=dict(LANG='C', LC_ALL='C', LC_MESSAGES='C'))
if rc != 0:
raise UnarchiveError('Unable to list files in the archive')
@@ -577,7 +577,7 @@ class TgzArchive(object):
if self.excludes:
cmd += ' --exclude="' + '" --exclude="'.join(self.excludes) + '"'
cmd += ' -f "%s"' % self.src
- rc, out, err = self.module.run_command(cmd)
+ rc, out, err = self.module.run_command(cmd, environ_update=dict(LANG='C', LC_ALL='C', LC_MESSAGES='C'))
# Check whether the differences are in something that we're
# setting anyway
@@ -618,7 +618,7 @@ class TgzArchive(object):
if self.excludes:
cmd += ' --exclude="' + '" --exclude="'.join(self.excludes) + '"'
cmd += ' -f "%s"' % (self.src)
- rc, out, err = self.module.run_command(cmd, cwd=self.dest)
+ rc, out, err = self.module.run_command(cmd, cwd=self.dest, environ_update=dict(LANG='C', LC_ALL='C', LC_MESSAGES='C'))
return dict(cmd=cmd, rc=rc, out=out, err=err)
def can_handle_archive(self):
@@ -690,9 +690,6 @@ def main():
# supports_check_mode = True,
)
- # We screenscrape a huge amount of commands so use C locale anytime we do
- module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C', LC_CTYPE='C')
-
src = os.path.expanduser(module.params['src'])
dest = os.path.expanduser(module.params['dest'])
copy = module.params['copy']
diff --git a/network/basics/get_url.py b/network/basics/get_url.py
index 53cb38d2..c59161f5 100644
--- a/network/basics/get_url.py
+++ b/network/basics/get_url.py
@@ -207,7 +207,7 @@ def url_get(module, url, dest, use_proxy, last_mod_time, force, timeout=10, head
module.exit_json(url=url, dest=dest, changed=False, msg=info.get('msg', ''))
# create a temporary file and copy content to do checksum-based replacement
- if info['status'] != 200 and not url.startswith('file:/'):
+ if info['status'] != 200 and not url.startswith('file:/') and not (url.startswith('ftp:/') and info.get('msg', '').startswith('OK')):
module.fail_json(msg="Request failed", status_code=info['status'], response=info['msg'], url=url, dest=dest)
if tmp_dest != '':
@@ -343,6 +343,11 @@ def main():
mtime = os.path.getmtime(dest)
last_mod_time = datetime.datetime.utcfromtimestamp(mtime)
+ # If the checksum does not match we have to force the download
+ # because last_mod_time may be newer than on remote
+ if checksum_mismatch:
+ force = True
+
# download to tmpsrc
tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force, timeout, headers, tmp_dest)
diff --git a/windows/win_user.ps1 b/windows/win_user.ps1
index 0ca11c74..5eba6ad2 100644
--- a/windows/win_user.ps1
+++ b/windows/win_user.ps1
@@ -137,8 +137,16 @@ If ($state -eq 'present') {
[void][system.reflection.assembly]::LoadWithPartialName('System.DirectoryServices.AccountManagement')
$host_name = [System.Net.Dns]::GetHostName()
$pc = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext 'Machine', $host_name
- # ValidateCredentials fails if PasswordExpired == 1
- If (!$pc.ValidateCredentials($username, $password)) {
+
+ # ValidateCredentials will fail if either of these are true- just force update...
+ If($user_obj.AccountDisabled -or $user_obj.PasswordExpired) {
+ $password_match = $false
+ }
+ Else {
+ $password_match = $pc.ValidateCredentials($username, $password)
+ }
+
+ If (-not $password_match) {
$user_obj.SetPassword($password)
$result.changed = $true
}