mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 14:05:59 -03:30
Additional flake8 cleanup
The flake8 command was identifying several warnings and errors. This change addresses the flake8 warnings and updates the setup.cfg with additional exclusions. If accepted, jenkins will be updated to use the flake8 command, rather than using the django_jenkins plugin. This will expedite jenkins testing.
This commit is contained in:
@@ -36,11 +36,8 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import pwd
|
||||
import sys
|
||||
import urllib
|
||||
import urlparse
|
||||
import time
|
||||
from contextlib import closing
|
||||
|
||||
# Requests
|
||||
import requests
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
import sys
|
||||
import time
|
||||
import datetime
|
||||
import json
|
||||
from copy import deepcopy
|
||||
from ansible import constants as C
|
||||
from ansible.cache.base import BaseCacheModule
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
# This file is a utility script that is not part of the AWX or Ansible
|
||||
# packages. It does not import any code from either package, nor does its
|
||||
# license apply to Ansible or AWX.
|
||||
#
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
@@ -61,7 +61,7 @@ class TokenAuth(requests.auth.AuthBase):
|
||||
return request
|
||||
|
||||
class InventoryScript(object):
|
||||
|
||||
|
||||
def __init__(self, **options):
|
||||
self.options = options
|
||||
|
||||
@@ -95,11 +95,11 @@ class InventoryScript(object):
|
||||
def run(self):
|
||||
try:
|
||||
self.base_url = self.options.get('base_url', '') or \
|
||||
os.getenv('REST_API_URL', '')
|
||||
os.getenv('REST_API_URL', '')
|
||||
if not self.base_url:
|
||||
raise ValueError('No REST API URL specified')
|
||||
self.auth_token = self.options.get('authtoken', '') or \
|
||||
os.getenv('REST_API_TOKEN', '')
|
||||
os.getenv('REST_API_TOKEN', '')
|
||||
parts = urlparse.urlsplit(self.base_url)
|
||||
if not (parts.username and parts.password) and not self.auth_token:
|
||||
raise ValueError('No username/password specified in REST API '
|
||||
@@ -107,7 +107,7 @@ class InventoryScript(object):
|
||||
try:
|
||||
# Command line argument takes precedence over environment
|
||||
# variable.
|
||||
self.inventory_id = int(self.options.get('inventory_id', 0) or \
|
||||
self.inventory_id = int(self.options.get('inventory_id', 0) or
|
||||
os.getenv('INVENTORY_ID', 0))
|
||||
except ValueError:
|
||||
raise ValueError('Inventory ID must be an integer')
|
||||
|
||||
@@ -84,7 +84,7 @@ class ServiceScanService(BaseService):
|
||||
else:
|
||||
pid = None
|
||||
else:
|
||||
pid = None
|
||||
pid = None # NOQA
|
||||
payload = {"name": service_name, "state": service_state, "goal": service_goal, "source": "upstart"}
|
||||
services.append(payload)
|
||||
|
||||
@@ -104,7 +104,7 @@ class ServiceScanService(BaseService):
|
||||
service_state = "dead"
|
||||
elif len(line_data) == 3:
|
||||
service_name = line_data[0]
|
||||
service_pid = None
|
||||
service_pid = None # NOQA
|
||||
service_state = "stopped"
|
||||
else:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user