1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix some warning of undefined name.

This commit is contained in:
soarpenguin 2015-10-09 11:19:24 +08:00
parent 59d655c543
commit 5efa4d29e3
5 changed files with 13 additions and 8 deletions

View file

@ -28,6 +28,7 @@
#
import pprint
from libcloud.compute.providers import get_driver
USER_AGENT_PRODUCT="Ansible-gce"
USER_AGENT_VERSION="v1"

View file

@ -76,7 +76,7 @@ class VcaAnsibleModule(AnsibleModule):
gateway_name = self.params['gateway_name']
_gateway = self.vca.get_gateway(vdc_name, gateway_name)
if not _gateway:
raise VcaError('vca instance has no gateway named %s' % name)
raise VcaError('vca instance has no gateway named %s' % gateway_name)
self._gateway = _gateway
return _gateway
@ -84,9 +84,10 @@ class VcaAnsibleModule(AnsibleModule):
def vdc(self):
if self._vdc is not None:
return self._vdc
_vdc = self.vca.get_vdc(self.params['vdc_name'])
vdc_name = self.params['vdc_name']
_vdc = self.vca.get_vdc(vdc_name)
if not _vdc:
raise VcaError('vca instance has no vdc named %s' % name)
raise VcaError('vca instance has no vdc named %s' % vdc_name)
self._vdc = _vdc
return _vdc

View file

@ -21,10 +21,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys
from ansible import constants as C
from ansible.inventory.group import Group
from .host import Host
from ansible.plugins.inventory.aggregate import InventoryAggregateParser
from ansible import errors
class Inventory:
'''
@ -98,7 +101,7 @@ class Inventory:
'''
for group in self._groups:
if group.name == group_name:
if group.name == groupname:
return group
return None

View file

@ -47,9 +47,9 @@ class InventoryDirectoryParser(InventoryAggregateParser):
if filename in ("host_vars", "group_vars", "vars_plugins"):
continue
fullpath = os.path.join(directory, filename)
new_names.append(fullpath)
filtered_names.append(fullpath)
super(InventoryDirectoryParser, self).__init__(new_names)
super(InventoryDirectoryParser, self).__init__(filtered_names)
def parse(self):
return super(InventoryDirectoryParser, self).parse()

View file

@ -47,9 +47,9 @@ class InventoryIniParser(InventoryAggregateParser):
if filename in ("host_vars", "group_vars", "vars_plugins"):
continue
fullpath = os.path.join(directory, filename)
new_names.append(fullpath)
filtered_names.append(fullpath)
super(InventoryDirectoryParser, self).__init__(new_names)
super(InventoryDirectoryParser, self).__init__(filtered_names)
def parse(self):
return super(InventoryDirectoryParser, self).parse()