def main():
    """Launch validator API """
    try:
        config.parse_args()
        logging.setup(CONF, 'chef_validator_api')
        app = config.load_paste_app("chef_validator_api")
        port, host = (CONF.bind_port, CONF.bind_host)
        LOG.info(_LI('Starting Chef Validator ReST API on %(host)s:%(port)s'),
                 {'host': host, 'port': port})
        server = wsgi.Service(app, port, host)
        server.start()
        server.wait()
    except RuntimeError as e:
        msg = six.text_type(e)
        sys.exit("ERROR: %s" % msg)
Example #2
0
#       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 mox

from oslo_config import cfg
from chef_validator.common import log
import testtools
import fixtures

CONF = cfg.CONF
log.setup(CONF, 'chef_validator')


class ValidatorTestCase(testtools.TestCase):
    """Default test environment setter"""

    def setUp(self):
        """setup logger fixture"""
        super(ValidatorTestCase, self).setUp()
        # self.useFixture(fixtures.FakeLogger())
        self.useFixture(fixtures.WarningsCapture())
        self.m = mox.Mox()
        self.addCleanup(self.m.UnsetStubs)

    def override_config(self, name, override, group=None):
        """
Example #3
0
 def reset(self):
     super(Service, self).reset()
     logging.setup(CONF, 'chef_validator')
# /usr/(local/)lib/python...
root = os.path.abspath(
    os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir)
)
if os.path.exists(os.path.join(root, 'chef_validator', '__init__.py')):
    sys.path.insert(0, root)

# simple local logging
from chef_validator.common import log as logging

LOG = logging.getLogger(__name__)

cfg.CONF.debug = True
cfg.CONF.logging_default_format_string = \
    "%(levelname)s (%(module)s:%(lineno)d) %(message)s"
logging.setup(cfg.CONF, 'chef_validator_client')

# local configuration
opts = [
    cfg.StrOpt('image', help="Glance Image to deploy"),
    cfg.StrOpt('cookbook', help="Name of the cookbook to deploy"),
    cfg.StrOpt('username', help="Keystone username"),
    cfg.StrOpt('password', help="Keystone password"),
    cfg.StrOpt('validator_url', help="Chef Validator Url"),
]
cfg.CONF.register_cli_opts(opts)
cfg.CONF(sys.argv[1:])
CONF = cfg.CONF

# default values
USERNAME = os.environ.get('OS_USERNAME', CONF.username)