Even more pep8 fixes that the gate is catching
Change-Id: I825621d82bdc4e30a024b639f34e8be0d8593c17
This commit is contained in:
parent
0b641d436e
commit
7efb4ae83a
@ -29,6 +29,7 @@ This is the MoltenIron server.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import argparse
|
||||||
import calendar
|
import calendar
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
@ -37,25 +38,24 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import yaml
|
import yaml
|
||||||
import argparse
|
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
|
||||||
from sqlalchemy import Column, Integer, String, ForeignKey
|
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||||
|
from sqlalchemy.exc import OperationalError
|
||||||
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
from sqlalchemy.schema import MetaData, Table
|
||||||
from sqlalchemy.sql import insert, update, delete
|
from sqlalchemy.sql import insert, update, delete
|
||||||
from sqlalchemy.sql import and_
|
from sqlalchemy.sql import and_
|
||||||
from sqlalchemy.types import TIMESTAMP
|
from sqlalchemy.types import TIMESTAMP
|
||||||
from sqlalchemy.schema import MetaData, Table
|
|
||||||
|
|
||||||
import sqlalchemy_utils
|
import sqlalchemy_utils
|
||||||
from sqlalchemy.exc import OperationalError
|
|
||||||
|
|
||||||
import collections # noqa
|
import collections # noqa
|
||||||
|
|
||||||
if (sys.version_info >= (3, 0)):
|
if sys.version_info >= (3, 0):
|
||||||
from http.server import HTTPServer, BaseHTTPRequestHandler # noqa
|
from http.server import HTTPServer, BaseHTTPRequestHandler # noqa
|
||||||
else:
|
else:
|
||||||
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler # noqa
|
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler # noqa
|
||||||
@ -166,7 +166,7 @@ class Nodes(declarative_base()):
|
|||||||
# from sqlalchemy.dialects.mysql import INTEGER
|
# from sqlalchemy.dialects.mysql import INTEGER
|
||||||
|
|
||||||
# CREATE TABLE `Nodes` (
|
# CREATE TABLE `Nodes` (
|
||||||
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO UNSIGNED
|
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO(hamzy) UNSIGNED
|
||||||
# name VARCHAR(50),
|
# name VARCHAR(50),
|
||||||
# ipmi_ip VARCHAR(50),
|
# ipmi_ip VARCHAR(50),
|
||||||
# ipmi_user VARCHAR(50),
|
# ipmi_user VARCHAR(50),
|
||||||
@ -254,8 +254,9 @@ class IPs(declarative_base()):
|
|||||||
__tablename__ = 'IPs'
|
__tablename__ = 'IPs'
|
||||||
|
|
||||||
# CREATE TABLE `IPs` (
|
# CREATE TABLE `IPs` (
|
||||||
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO INTEGER(unsigned=True)
|
# id INTEGER NOT NULL AUTO_INCREMENT, #@TODO(hamzy) \
|
||||||
# node_id INTEGER, #@TODO UNSIGNED
|
# INTEGER(unsigned=True)
|
||||||
|
# node_id INTEGER, #@TODO(hamzy) UNSIGNED
|
||||||
# ip VARCHAR(50),
|
# ip VARCHAR(50),
|
||||||
# PRIMARY KEY (id),
|
# PRIMARY KEY (id),
|
||||||
# FOREIGN KEY(node_id) REFERENCES `Nodes` (id)
|
# FOREIGN KEY(node_id) REFERENCES `Nodes` (id)
|
||||||
@ -293,7 +294,7 @@ TYPE_SQLITE = 3
|
|||||||
TYPE_SQLITE_MEMORY = 4
|
TYPE_SQLITE_MEMORY = 4
|
||||||
|
|
||||||
|
|
||||||
class DataBase():
|
class DataBase(object):
|
||||||
"""This class may be used access the molten iron database. """
|
"""This class may be used access the molten iron database. """
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
@ -546,10 +547,10 @@ class DataBase():
|
|||||||
# and ("." in node_id):
|
# and ("." in node_id):
|
||||||
|
|
||||||
check = isinstance(node_id, str)
|
check = isinstance(node_id, str)
|
||||||
if (sys.version_info < (3, 0)):
|
if sys.version_info < (3, 0):
|
||||||
check = check or isinstance(node_id, unicode) # noqa
|
check = check or isinstance(node_id, unicode) # noqa
|
||||||
|
|
||||||
if (check and ("." in node_id)):
|
if check and ("." in node_id):
|
||||||
# If an ipmi_ip was passed
|
# If an ipmi_ip was passed
|
||||||
query = query.filter_by(ipmi_ip=node_id)
|
query = query.filter_by(ipmi_ip=node_id)
|
||||||
else:
|
else:
|
||||||
@ -744,11 +745,11 @@ class DataBase():
|
|||||||
return {'status': 200}
|
return {'status': 200}
|
||||||
|
|
||||||
def cull(self, maxSeconds):
|
def cull(self, maxSeconds):
|
||||||
"""If any node has been in use for longer than maxSeconds, deallocate
|
"""Deallocate old nodes.
|
||||||
that node.
|
|
||||||
|
|
||||||
Nodes that are deallocated in this way get their state set to "dirty".
|
If any node has been in use for longer than maxSeconds, deallocate
|
||||||
They are also scheduled for cleaning.
|
that node. Nodes that are deallocated in this way get their state set
|
||||||
|
to "dirty". They are also scheduled for cleaning.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
@ -845,7 +846,7 @@ class DataBase():
|
|||||||
|
|
||||||
return {'status': 200}
|
return {'status': 200}
|
||||||
|
|
||||||
# @TODO shouldn't it return allocation_pool rather than ipmi_ip?
|
# @TODO(hamzy) shouldn't it return allocation_pool rather than ipmi_ip?
|
||||||
def get_ips(self, owner_name):
|
def get_ips(self, owner_name):
|
||||||
"""Return all IPs allocated to a given node owner
|
"""Return all IPs allocated to a given node owner
|
||||||
|
|
||||||
@ -953,8 +954,9 @@ class DataBase():
|
|||||||
return {'status': 200}
|
return {'status': 200}
|
||||||
|
|
||||||
def setup_status(self):
|
def setup_status(self):
|
||||||
"""Setup the status formatting strings depending on skipped elements,
|
"""Setup the status formatting strings.
|
||||||
lengths, and types.
|
|
||||||
|
Which depends on the skipped elements, lengths, and types.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.result_separator = "+"
|
self.result_separator = "+"
|
||||||
|
@ -23,11 +23,11 @@ Tests the addBMNode MoltenIron command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
||||||
|
@ -23,11 +23,11 @@ Tests the MoltenIron allocateBM command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
def compare_provisioned_nodes(lhs, rhs):
|
def compare_provisioned_nodes(lhs, rhs):
|
||||||
|
@ -10,7 +10,7 @@ Tests the MoltenIron cull command.
|
|||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http: //www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@ -23,12 +23,12 @@ Tests the MoltenIron cull command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
def compare_culled_nodes(lhs, rhs):
|
def compare_culled_nodes(lhs, rhs):
|
||||||
|
@ -23,11 +23,11 @@ Tests the MoltenIron deallocateBM command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
def compare_provisioned_nodes(lhs, rhs):
|
def compare_provisioned_nodes(lhs, rhs):
|
||||||
|
@ -23,11 +23,11 @@ Tests the MoltenIron deallocateOwner command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
def compare_provisioned_nodes(lhs, rhs):
|
def compare_provisioned_nodes(lhs, rhs):
|
||||||
|
@ -23,11 +23,12 @@ Tests the MoltenIron doClean command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
||||||
|
@ -23,11 +23,12 @@ Tests the MoltenIron get_field command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
||||||
|
@ -23,11 +23,12 @@ Tests the MoltenIron get_ips command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
||||||
|
@ -23,11 +23,12 @@ Tests the MoltenIron removeBMNode command.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
import argparse
|
import argparse
|
||||||
from molteniron import moltenirond
|
from molteniron import moltenirond
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
parser = argparse.ArgumentParser(description="Molteniron CLI tool")
|
||||||
|
Loading…
Reference in New Issue
Block a user