From 4420379f593333eef622b54b2df5bdff20cc7871 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 23 Sep 2013 16:05:43 -0500 Subject: [PATCH] Fixing some bugs found during testing in the host module --- CHANGELOG.md | 1 + library/system/host | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ca9b0be16..5dae9b73a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ New modules: * cloud:ec2_eip -- manage AWS elastic IP's * cloud:rax_clb_nodes -- manage Rackspace cloud load balancers * system: firewalld -- manage the firewalld configuration +* system: host -- manage host file entries and aliases * system: modprobe -- manage kernel modules on systems that support modprobe/rmmod Misc changes: diff --git a/library/system/host b/library/system/host index 21f4e036a4d..f8a5f169bf9 100644 --- a/library/system/host +++ b/library/system/host @@ -50,11 +50,10 @@ options: EXAMPLES = ''' # Example host command from Ansible Playbooks -- host: ip=127.0.0.1 hostname=localhost aliases=foobar.com,localhost.foobar.com - host: ip=127.0.0.1 hostname=localhost state=present +- host: ip=127.0.0.1 hostname=localhost aliases=foobar.com,localhost.foobar.com - host: ip=192.168.1.1 state=absent -- host: hostname=localhost state=absent -- host: ip=::1 hostname=localhost aliases=ip6-localhost,ip6-loopback +- host: ip=::1 hostname=localhost6 aliases=ip6-localhost,ip6-loopback ''' import os @@ -126,10 +125,10 @@ class Host(object): def full_entry_exists(self): if self._has_aliases and not self._aliases_matches: return False - return self._ip_matches and self.hostname_matches + return self._ip_matches and self._hostname_matches def entry_exists(self): - return self._ip_matches or self.hostname_matches + return self._ip_matches or self._hostname_matches def remove_entry(self): self._hostsfile_lines.pop(self._found_on_line) @@ -165,7 +164,7 @@ def main(): result = {} host = Host(module) result['state'] = host.state - result['changed'] = false + result['changed'] = False err = host.validate_has_hostname_on_present() if err: