Enable hacking

Change-Id: I7c26e11d83dee13e8bbcb024473d916a27f3e867
This commit is contained in:
Dmitry Tantsur 2014-11-14 15:34:32 +01:00
parent 5a28c1790d
commit 969616eb2c
8 changed files with 109 additions and 7 deletions

View File

@ -1,3 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse import argparse
import json import json

View File

@ -1,3 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from six.moves import configparser from six.moves import configparser

View File

@ -1,8 +1,20 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging import logging
import time import time
import eventlet import eventlet
from ironicclient import exceptions from ironicclient import exceptions
from ironic_discoverd import conf from ironic_discoverd import conf
@ -106,6 +118,10 @@ def process(node_info):
LOG.error('Node is not on discovery, cannot proceed') LOG.error('Node is not on discovery, cannot proceed')
return return
_process_node(ironic, node, node_info, valid_macs)
def _process_node(ironic, node, node_info, valid_macs):
patch = [{'op': 'add', 'path': '/extra/newly_discovered', 'value': 'true'}, patch = [{'op': 'add', 'path': '/extra/newly_discovered', 'value': 'true'},
{'op': 'remove', 'path': '/extra/on_discovery'}] {'op': 'remove', 'path': '/extra/on_discovery'}]
existing = node.properties existing = node.properties

View File

@ -1,3 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging import logging
import subprocess import subprocess

View File

@ -1,10 +1,23 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import eventlet import eventlet
eventlet.monkey_patch(thread=False) eventlet.monkey_patch(thread=False)
import logging import logging
import sys import sys
from flask import Flask, request from flask import Flask, request # noqa
from keystoneclient import exceptions from keystoneclient import exceptions
@ -68,8 +81,8 @@ def main():
logging.basicConfig(level=logging.DEBUG if debug else logging.INFO) logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING) logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
logging.getLogger('requests.packages.urllib3.connectionpool') \ logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(
.setLevel(logging.WARNING) logging.WARNING)
if not conf.getboolean('discoverd', 'authenticate'): if not conf.getboolean('discoverd', 'authenticate'):
LOG.warning('Starting unauthenticated, please check configuration') LOG.warning('Starting unauthenticated, please check configuration')

View File

@ -1,3 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import eventlet import eventlet
eventlet.monkey_patch(thread=False) eventlet.monkey_patch(thread=False)
@ -6,7 +19,7 @@ import unittest
from ironicclient import exceptions from ironicclient import exceptions
from keystoneclient import exceptions as keystone_exc from keystoneclient import exceptions as keystone_exc
from mock import patch, Mock, ANY from mock import patch, Mock, ANY # noqa
from ironic_discoverd import client from ironic_discoverd import client
from ironic_discoverd import conf from ironic_discoverd import conf

View File

@ -1,3 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging import logging
import re import re
@ -30,7 +43,9 @@ def is_valid_mac(address):
def check_ironic_available(): def check_ironic_available():
"""Try to make sure: """Try to make sure we can reach Ironic.
Ensure that:
1. Keystone access is configured properly 1. Keystone access is configured properly
2. Keystone has already started 2. Keystone has already started
3. Ironic has already started 3. Ironic has already started

View File

@ -15,8 +15,14 @@ commands =
basepython = python2.7 basepython = python2.7
deps = deps =
-rrequirements.txt -rrequirements.txt
flake8 hacking
docutils docutils
commands = commands =
flake8 ironic_discoverd flake8 ironic_discoverd
rst2html.py --strict README.rst /dev/null rst2html.py --strict README.rst /dev/null
[flake8]
max-complexity=20
[hacking]
import_exceptions = ironicclient.exceptions