Cleanup more pyflakes warnings (2 real problems)

pull/12835/head
Toshio Kuratomi 9 years ago
parent 1fa975d81a
commit 7aa9f6754a

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

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

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

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

@ -31,7 +31,7 @@ __metaclass__ = type
import os
from ansible.errors import *
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
@ -59,16 +59,13 @@ class HashiVault:
raise AnsibleError("Invalid Hashicorp Vault Token Specified")
def get(self):
value = ""
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)
else:
return data['data']['value']
class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs):

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

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

Loading…
Cancel
Save