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

Cleanup more pyflakes warnings (2 real problems)

This commit is contained in:
Toshio Kuratomi 2015-10-19 11:58:36 -07:00
parent 1fa975d81a
commit 7aa9f6754a
7 changed files with 13 additions and 22 deletions

View file

@ -17,11 +17,10 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os
import codecs import codecs
import csv import csv
from ansible.errors import * from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase): class LookupModule(LookupBase):

View file

@ -24,8 +24,9 @@ import socket
try: try:
import dns.resolver import dns.resolver
import dns.reversename import dns.reversename
from dns.rdatatype import * from dns.rdatatype import (A, AAAA, CNAME, DLV, DNAME, DNSKEY, DS, HINFO, LOC,
from dns.exception import DNSException MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT)
import dns.exception
HAVE_DNS = True HAVE_DNS = True
except ImportError: except ImportError:
HAVE_DNS = False HAVE_DNS = False

View file

@ -17,8 +17,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os
HAVE_DNS=False HAVE_DNS=False
try: try:
import dns.resolver import dns.resolver
@ -27,7 +25,7 @@ try:
except ImportError: except ImportError:
pass pass
from ansible.errors import * from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
# ============================================================== # ==============================================================
@ -58,7 +56,7 @@ class LookupModule(LookupBase):
string = 'NXDOMAIN' string = 'NXDOMAIN'
except dns.resolver.Timeout: except dns.resolver.Timeout:
string = '' string = ''
except dns.exception.DNSException as e: except DNSException as e:
raise AnsibleError("dns.resolver unhandled exception", e) raise AnsibleError("dns.resolver unhandled exception", e)
ret.append(''.join(string)) ret.append(''.join(string))

View file

@ -17,10 +17,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os from ansible.errors import AnsibleError, AnsibleParserError
import codecs
from ansible.errors import *
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase): class LookupModule(LookupBase):

View file

@ -31,7 +31,7 @@ __metaclass__ = type
import os import os
from ansible.errors import * from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
@ -59,16 +59,13 @@ class HashiVault:
raise AnsibleError("Invalid Hashicorp Vault Token Specified") raise AnsibleError("Invalid Hashicorp Vault Token Specified")
def get(self): def get(self):
value = ""
data = self.client.read(self.secret) data = self.client.read(self.secret)
if data == None: if data is None:
raise AnsibleError("The secret %s doesn't seem to exist" % self.secret) raise AnsibleError("The secret %s doesn't seem to exist" % self.secret)
else: else:
return data['data']['value'] return data['data']['value']
class LookupModule(LookupBase): class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs): def run(self, terms, variables, **kwargs):

View file

@ -19,11 +19,10 @@ __metaclass__ = type
import StringIO import StringIO
import os import os
import codecs
import ConfigParser import ConfigParser
import re import re
from ansible.errors import * from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase): class LookupModule(LookupBase):
@ -47,7 +46,7 @@ class LookupModule(LookupBase):
# Retrieve a single value # Retrieve a single value
try: try:
value = self.cp.get(section, key) value = self.cp.get(section, key)
except ConfigParser.NoOptionError as e: except ConfigParser.NoOptionError:
return dflt return dflt
return value return value
@ -77,7 +76,7 @@ class LookupModule(LookupBase):
assert(name in paramvals) assert(name in paramvals)
paramvals[name] = value paramvals[name] = value
except (ValueError, AssertionError) as e: except (ValueError, AssertionError) as e:
raise errors.AnsibleError(e) raise AnsibleError(e)
path = self._loader.path_dwim_relative(basedir, 'files', paramvals['file']) path = self._loader.path_dwim_relative(basedir, 'files', paramvals['file'])
if paramvals['type'] == "properties": if paramvals['type'] == "properties":

View file

@ -19,7 +19,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import subprocess import subprocess
from ansible.errors import * from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase): class LookupModule(LookupBase):