Merge pull request #12689 from soarpenguin/bugfix

Remove some warning of undefined name and fix classmethod syntax error.
This commit is contained in:
Brian Coca 2015-10-09 11:09:50 -04:00
commit ec02b255c3
6 changed files with 19 additions and 14 deletions

View file

@ -473,13 +473,13 @@ class CLI(object):
pass
@classmethod
def tty_ify(self, text):
def tty_ify(cls, text):
t = self._ITALIC.sub("`" + r"\1" + "'", text) # I(word) => `word'
t = self._BOLD.sub("*" + r"\1" + "*", t) # B(word) => *word*
t = self._MODULE.sub("[" + r"\1" + "]", t) # M(word) => [word]
t = self._URL.sub(r"\1", t) # U(word) => word
t = self._CONST.sub("`" + r"\1" + "'", t) # C(word) => `word'
t = cls._ITALIC.sub("`" + r"\1" + "'", text) # I(word) => `word'
t = cls._BOLD.sub("*" + r"\1" + "*", t) # B(word) => *word*
t = cls._MODULE.sub("[" + r"\1" + "]", t) # M(word) => [word]
t = cls._URL.sub(r"\1", t) # U(word) => word
t = cls._CONST.sub("`" + r"\1" + "'", t) # C(word) => `word'
return t

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()