mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Using __slots__ in more places, in particular, hosts and groups, where we are apt to create a fair amount of objects.
This commit is contained in:
parent
84e1d21b9c
commit
57f12ac9e3
4 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" +
|
||||
|
|
Loading…
Reference in a new issue