Flake requirements
* Added Apache Licence for each file. * Pep8 fixes Change-Id: Iba54681c048c612e4b7e5859edf4f3713934f290
This commit is contained in:
parent
bad515ff64
commit
e63ae730a3
@ -1 +1,13 @@
|
||||
# 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.
|
||||
|
||||
REPOS_DIR = '/var/lib/fuel_repos'
|
||||
|
@ -1,24 +1,37 @@
|
||||
# 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 copy
|
||||
import os
|
||||
import yaml
|
||||
import copy
|
||||
|
||||
from nailgun.logger import logger
|
||||
|
||||
from nailgun.extensions import BaseExtension
|
||||
from nailgun.extensions import BasePipeline
|
||||
|
||||
from fuel_external_git import const
|
||||
from fuel_external_git import handlers
|
||||
from fuel_external_git.objects import GitRepo
|
||||
from fuel_external_git.settings import GitExtensionSettings
|
||||
from fuel_external_git import const
|
||||
from fuel_external_git import utils
|
||||
|
||||
from nailgun.extensions import BaseExtension
|
||||
from nailgun.extensions import BasePipeline
|
||||
from nailgun.logger import logger
|
||||
|
||||
|
||||
class OpenStackConfigPipeline(BasePipeline):
|
||||
# TODO (dukov) add cluster remove callback
|
||||
# TODO(dukov) add cluster remove callback
|
||||
@classmethod
|
||||
def process_deployment(cls, data, cluster, nodes, **kwargs):
|
||||
"""Genereate OpenStack configuration hash based on configuration files
|
||||
"""Updating deployment info
|
||||
|
||||
Genereate OpenStack configuration hash based on configuration files
|
||||
stored in git repository associated with a particular environment
|
||||
Example of configuration extension:
|
||||
configuration:
|
||||
@ -91,7 +104,8 @@ class OpenStackConfigPipeline(BasePipeline):
|
||||
logger.info("Node {0} config from git {1}".format(uid, common))
|
||||
return data
|
||||
|
||||
# TODO (dukov) Remove decorator extension management is available
|
||||
|
||||
# TODO(dukov) Remove decorator extension management is available
|
||||
@utils.register_extension(u'fuel_external_git')
|
||||
class ExternalGit(BaseExtension):
|
||||
name = 'fuel_external_git'
|
||||
|
@ -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.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import fabric.api
|
||||
from git import Repo
|
||||
import os
|
||||
|
||||
from cliff import command
|
||||
from cliff import lister
|
||||
from git import Repo
|
||||
|
||||
from fuelclient.client import APIClient
|
||||
from fuelclient.common import data_utils
|
||||
@ -88,7 +101,7 @@ class AddRepo(command.Command):
|
||||
with open(parsed_args.key) as key_file:
|
||||
data['user_key'] = key_file.read()
|
||||
|
||||
result = APIClient.post_request('/clusters/git-repos/', data)
|
||||
APIClient.post_request('/clusters/git-repos/', data)
|
||||
return (self.columns, data)
|
||||
|
||||
|
||||
@ -120,7 +133,7 @@ class DeleteRepo(command.Command):
|
||||
if repo['id'] == parsed_args.repo][0]
|
||||
|
||||
del_path = "/clusters/{0}/git-repos/{1}"
|
||||
result = APIClient.delete_request(del_path.format(env, repo_id))
|
||||
APIClient.delete_request(del_path.format(env, repo_id))
|
||||
return (self.columns, {})
|
||||
|
||||
|
||||
@ -208,7 +221,7 @@ class InitRepo(command.Command):
|
||||
if repo['id'] == parsed_args.repo][0]
|
||||
|
||||
init_path = "/clusters/{0}/git-repos/{1}/init"
|
||||
result = APIClient.put_request(init_path.format(env, repo_id), {})
|
||||
APIClient.put_request(init_path.format(env, repo_id), {})
|
||||
return (self.columns, {})
|
||||
|
||||
|
||||
|
@ -1,12 +1,26 @@
|
||||
from nailgun import objects
|
||||
from nailgun.errors import errors
|
||||
from nailgun.api.v1.validators import base
|
||||
from nailgun.api.v1.handlers.base import content
|
||||
from nailgun.api.v1.handlers.base import \
|
||||
SingleHandler, CollectionHandler, BaseHandler
|
||||
# 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 fuel_external_git.objects import GitRepo, GitRepoCollection
|
||||
from fuel_external_git import json_schema
|
||||
from fuel_external_git.objects import GitRepo
|
||||
from fuel_external_git.objects import GitRepoCollection
|
||||
|
||||
from nailgun.api.v1.handlers.base import BaseHandler
|
||||
from nailgun.api.v1.handlers.base import CollectionHandler
|
||||
from nailgun.api.v1.handlers.base import content
|
||||
from nailgun.api.v1.handlers.base import SingleHandler
|
||||
from nailgun.api.v1.validators import base
|
||||
from nailgun.errors import errors
|
||||
from nailgun import objects
|
||||
|
||||
REPOS_DIR = '/var/lib/fuel_repos'
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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.
|
||||
|
||||
single_schema = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Cluster",
|
||||
|
@ -16,19 +16,18 @@ import logging.config
|
||||
from alembic import context
|
||||
import sqlalchemy
|
||||
|
||||
#from tuning_box import db
|
||||
|
||||
config = context.config
|
||||
if config.get_main_option('table_prefix') is None:
|
||||
config.set_main_option('table_prefix', '')
|
||||
if config.config_file_name:
|
||||
logging.config.fileConfig(config.config_file_name)
|
||||
#target_metadata = db.db.metadata
|
||||
target_metadata = None
|
||||
|
||||
|
||||
def run_migrations_offline():
|
||||
"""Run migrations in 'offline' mode.
|
||||
|
||||
This configures the context with just a URL
|
||||
and not an Engine, though an Engine is acceptable
|
||||
here as well. By skipping the Engine creation
|
||||
@ -48,6 +47,7 @@ def run_migrations_offline():
|
||||
|
||||
def run_migrations_online():
|
||||
"""Run migrations in 'online' mode.
|
||||
|
||||
In this scenario we need to create an Engine
|
||||
and associate a connection with the context.
|
||||
"""
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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.
|
||||
|
||||
"""change_constrains
|
||||
|
||||
Revision ID: d59114c46ac4
|
||||
@ -13,6 +25,7 @@ branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import context
|
||||
from alembic import op
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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.
|
||||
|
||||
"""Init
|
||||
|
||||
Revision ID: e3b840e64e53
|
||||
@ -13,9 +25,9 @@ branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import context
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql as psql
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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 sqlalchemy import Column
|
||||
from sqlalchemy import Integer
|
||||
from sqlalchemy import String
|
||||
|
@ -1,19 +1,34 @@
|
||||
# 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 os
|
||||
import shutil
|
||||
import yaml
|
||||
|
||||
from distutils.dir_util import copy_tree
|
||||
|
||||
from nailgun.db import db
|
||||
from nailgun.objects import NailgunObject, NailgunCollection, Cluster
|
||||
from nailgun.objects.serializers.base import BasicSerializer
|
||||
from nailgun.logger import logger
|
||||
from nailgun.errors import errors
|
||||
|
||||
from git import Repo
|
||||
from git import exc
|
||||
|
||||
from fuel_external_git.models import GitRepo
|
||||
from fuel_external_git import const
|
||||
from fuel_external_git.models import GitRepo
|
||||
|
||||
from git import exc
|
||||
from git import Repo
|
||||
|
||||
from nailgun.db import db
|
||||
from nailgun.errors import errors
|
||||
from nailgun.logger import logger
|
||||
from nailgun.objects import Cluster
|
||||
from nailgun.objects import NailgunCollection
|
||||
from nailgun.objects import NailgunObject
|
||||
from nailgun.objects.serializers.base import BasicSerializer
|
||||
|
||||
|
||||
class GitRepoSerializer(BasicSerializer):
|
||||
@ -34,8 +49,7 @@ class GitRepo(NailgunObject):
|
||||
@classmethod
|
||||
def get_by_cluster_id(self, cluster_id):
|
||||
instance = db().query(self.model).\
|
||||
filter(self.model.env_id == cluster_id).\
|
||||
first()
|
||||
filter(self.model.env_id == cluster_id).first()
|
||||
if instance is not None:
|
||||
try:
|
||||
instance.repo = Repo(os.path.join(const.REPOS_DIR,
|
||||
@ -102,7 +116,7 @@ class GitRepo(NailgunObject):
|
||||
|
||||
try:
|
||||
self.checkout(instance)
|
||||
except exc.GitCommandError, e:
|
||||
except exc.GitCommandError as e:
|
||||
logger.debug(("Remote returned following error {}. "
|
||||
"Seem remote has not been initialised. "
|
||||
"Skipping checkout".format(e)))
|
||||
|
@ -1,12 +1,23 @@
|
||||
import os
|
||||
# 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 ConfigParser
|
||||
import os
|
||||
|
||||
from nailgun.logger import logger
|
||||
|
||||
|
||||
class OpenStackConfig(object):
|
||||
def __init__(self, config_file, resource_name=None):
|
||||
cf_basename = os.path.basename(config_file)
|
||||
self.config = ConfigParser.ConfigParser()
|
||||
self.config.read(config_file)
|
||||
if resource_name:
|
||||
@ -18,7 +29,9 @@ class OpenStackConfig(object):
|
||||
format(config_file, self.config_name))
|
||||
|
||||
def to_config_dict(self):
|
||||
"""Function returns OpenStack config file in dictionary form
|
||||
"""Config transformation
|
||||
|
||||
Function returns OpenStack config file in dictionary form
|
||||
compatible with override_configuration resource in
|
||||
fuel-library
|
||||
Example:
|
||||
|
@ -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.
|
||||
|
||||
# tst
|
||||
import os
|
||||
import yaml
|
||||
|
||||
|
16
fuel_external_git/templates/gitrepo/tools/show-config-for.py
Executable file → Normal file
16
fuel_external_git/templates/gitrepo/tools/show-config-for.py
Executable file → Normal file
@ -1,8 +1,20 @@
|
||||
#!/bin/env python
|
||||
# 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 ConfigParser
|
||||
import os
|
||||
import sys
|
||||
import ConfigParser
|
||||
import argparse
|
||||
import yaml
|
||||
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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 os
|
||||
|
||||
from oslotest import base
|
||||
|
@ -1,7 +1,19 @@
|
||||
# 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 os
|
||||
|
||||
from fuel_external_git.tests import base
|
||||
from fuel_external_git.openstack_config import OpenStackConfig
|
||||
from fuel_external_git.tests import base
|
||||
|
||||
|
||||
class TestOpenStackConfig(base.TestCase):
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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 copy
|
||||
from fuel_external_git.tests import base
|
||||
from fuel_external_git import utils
|
||||
|
@ -1,3 +1,15 @@
|
||||
# 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 os
|
||||
from oslo_utils import importutils
|
||||
|
||||
@ -6,8 +18,6 @@ from nailgun.db.sqlalchemy.models import Cluster
|
||||
from nailgun.db.sqlalchemy.models import Release
|
||||
from nailgun.logger import logger
|
||||
|
||||
from fuel_external_git.openstack_config import OpenStackConfig
|
||||
|
||||
|
||||
def get_file_exts_list(resource_mapping):
|
||||
res = set()
|
||||
@ -47,7 +57,7 @@ def deep_merge(dct, merge_dct):
|
||||
dct[k] = merge_dct[k]
|
||||
|
||||
|
||||
# TODO (dukov) Remove this ugly staff once extension management is available
|
||||
# TODO(dukov) Remove this ugly staff once extension management is available
|
||||
def register_extension(ext_name):
|
||||
def decorator(cls):
|
||||
exts = {cl: cl['extensions'] for cl in
|
||||
|
Loading…
Reference in New Issue
Block a user