Rename nova filters to include and exclude
jeblair says: "having 'flavor_filter' be inclusive, and 'image_filter' be exclusive is kind of mind blowing" and I agree. Let's be more explicit.
This commit is contained in:
parent
481911eb4e
commit
b89cac909a
1 changed files with 11 additions and 11 deletions
|
@ -83,9 +83,9 @@ options:
|
|||
required: true
|
||||
default: None
|
||||
version_added: "1.7"
|
||||
image_filter:
|
||||
image_exclude:
|
||||
description:
|
||||
- Text to use to filter image names, for the case, such as HP, where there are multiple image names matching the common identifying portions. image_filter is a negative match filter - it is text that may not exist in the image name. Defaults to "(deprecated)"
|
||||
- Text to use to filter image names, for the case, such as HP, where there are multiple image names matching the common identifying portions. image_exclude is a negative match filter - it is text that may not exist in the image name. Defaults to "(deprecated)"
|
||||
version_added: "1.7"
|
||||
flavor_id:
|
||||
description:
|
||||
|
@ -98,9 +98,9 @@ options:
|
|||
required: false
|
||||
default: 1
|
||||
version_added: "1.7"
|
||||
flavor_filter:
|
||||
flavor_include:
|
||||
description:
|
||||
- Text to use to filter flavor names, for the case, such as Rackspace, where there are multiple flavors that have the same ram count. flavor_filter is a positive match filter - it must exist in the flavor name.
|
||||
- Text to use to filter flavor names, for the case, such as Rackspace, where there are multiple flavors that have the same ram count. flavor_include is a positive match filter - it must exist in the flavor name.
|
||||
version_added: "1.7"
|
||||
key_name:
|
||||
description:
|
||||
|
@ -244,7 +244,7 @@ EXAMPLES = '''
|
|||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
|
||||
region_name: region-b.geo-1
|
||||
image_name: Ubuntu Server 14.04
|
||||
image_filter: deprecated
|
||||
image_exclude: deprecated
|
||||
flavor_ram: 4096
|
||||
|
||||
# Creates a new VM with 4G of RAM on Ubuntu Trusty on a Rackspace Performance node in DFW
|
||||
|
@ -262,7 +262,7 @@ EXAMPLES = '''
|
|||
region_name: DFW
|
||||
image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
|
||||
flavor_ram: 4096
|
||||
flavor_filter: Performance
|
||||
flavor_include: Performance
|
||||
'''
|
||||
|
||||
|
||||
|
@ -391,8 +391,8 @@ def _get_image_id(module, nova):
|
|||
if module.params['image_name']:
|
||||
for image in nova.images.list():
|
||||
if (module.params['image_name'] in image.name and (
|
||||
not module.params['image_filter']
|
||||
or module.params['image_filter'] not in image.name)):
|
||||
not module.params['image_exclude']
|
||||
or module.params['image_exclude'] not in image.name)):
|
||||
return image.id
|
||||
module.fail_json(msg = "Error finding image id from name(%s)" % module.params['image_name'])
|
||||
return module.params['image_id']
|
||||
|
@ -402,7 +402,7 @@ def _get_flavor_id(module, nova):
|
|||
if module.params['flavor_ram']:
|
||||
for flavor in sorted(nova.flavors.list(), key=operator.attrgetter('ram')):
|
||||
if (flavor.ram >= module.params['flavor_ram'] and
|
||||
(not module.params['flavor_filter'] or module.params['flavor_filter'] in flavor.name)):
|
||||
(not module.params['flavor_include'] or module.params['flavor_include'] in flavor.name)):
|
||||
return flavor.id
|
||||
module.fail_json(msg = "Error finding flavor with %sMB of RAM" % module.params['flavor_ram'])
|
||||
return module.params['flavor_id']
|
||||
|
@ -526,10 +526,10 @@ def main():
|
|||
name = dict(required=True),
|
||||
image_id = dict(default=None),
|
||||
image_name = dict(default=None),
|
||||
image_filter = dict(default='(deprecated)'),
|
||||
image_exclude = dict(default='(deprecated)'),
|
||||
flavor_id = dict(default=1),
|
||||
flavor_ram = dict(default=None, type='int'),
|
||||
flavor_filter = dict(default=None),
|
||||
flavor_include = dict(default=None),
|
||||
key_name = dict(default=None),
|
||||
security_groups = dict(default='default'),
|
||||
nics = dict(default=None),
|
||||
|
|
Loading…
Reference in a new issue