diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 60a3523abaa..7c2212c5a02 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -35,6 +35,9 @@ class Inventory(object): Host inventory for ansible. """ + __slots__ = [ 'host_list', 'groups', '_restriction', '_is_script', + 'parser' ] + def __init__(self, host_list=C.DEFAULT_HOST_LIST): # the host file file, or script path, or list of hosts diff --git a/lib/ansible/inventory/group.py b/lib/ansible/inventory/group.py index a51de0c89c5..9552f244c78 100644 --- a/lib/ansible/inventory/group.py +++ b/lib/ansible/inventory/group.py @@ -18,6 +18,8 @@ class Group(object): ''' a group of ansible hosts ''' + __slots__ = [ 'name', 'hosts', 'vars', 'child_groups', 'parent_groups' ] + def __init__(self, name=None): self.name = name diff --git a/lib/ansible/inventory/host.py b/lib/ansible/inventory/host.py index 0c43471801c..c96a5cb0ce8 100644 --- a/lib/ansible/inventory/host.py +++ b/lib/ansible/inventory/host.py @@ -21,6 +21,8 @@ import ansible.constants as C class Host(object): ''' a single ansible host ''' + __slots__ = [ 'name', 'vars', 'groups' ] + def __init__(self, name=None, port=None): self.name = name diff --git a/lib/ansible/inventory/yaml.py b/lib/ansible/inventory/yaml.py index afeaa401395..f17aa723136 100644 --- a/lib/ansible/inventory/yaml.py +++ b/lib/ansible/inventory/yaml.py @@ -25,6 +25,8 @@ import sys class InventoryParserYaml(object): ''' Host inventory parser for ansible ''' + __slots__ = [ '_hosts', 'groups' ] + def __init__(self, filename=C.DEFAULT_HOST_LIST): sys.stderr.write("WARNING: YAML inventory files are deprecated in 0.6 and will be removed in 0.7, to migrate" +