Remove Pegleg stub logic from CLI and engine
This patch set removes Pegleg stub logic from the CLI and engine because: 1) It's currently broken following revisioned repository support with https://review.openstack.org/#/c/577886/ 2) The functionality isn't used anywhere in Airship, either upstream or downstream 3) The functionality is, in any case, obsolete following the revision repository change As such, it is better if we simply remove the stub logic out for now and revisit the implementation later, once the requirements for it are fully fleshed out to align with modern Pegleg architecture. Change-Id: If82b91bcdd39555596f2a4003bfda0167142fddd
This commit is contained in:
parent
de67b8e2ea
commit
372b0a541e
@ -209,63 +209,6 @@ def lint(*, fail_on_missing_sub_src, exclude_lint, warn_lint, site_name):
|
||||
warn_lint=warn_lint)
|
||||
|
||||
|
||||
def _validate_revision_callback(_ctx, _param, value):
|
||||
if value is not None and value.startswith('v'):
|
||||
return value
|
||||
else:
|
||||
raise click.BadParameter('revisions must start with "v"')
|
||||
|
||||
|
||||
@main.group(help='Create directory structure and stubs')
|
||||
def stub():
|
||||
pass
|
||||
|
||||
|
||||
RELEASE_OPTION = click.option(
|
||||
'-r',
|
||||
'--revision',
|
||||
callback=_validate_revision_callback,
|
||||
required=True,
|
||||
help='Configuration revision to use (e.g. v1.0)')
|
||||
|
||||
SITE_TYPE_OPTION = click.option(
|
||||
'-t',
|
||||
'--site-type',
|
||||
required=True,
|
||||
help='Site type to use ("large", "medium", "cicd", "labs", etc.')
|
||||
|
||||
LINT_OPTION = click.option(
|
||||
'-f',
|
||||
'--fail-on-missing-sub-src',
|
||||
required=False,
|
||||
type=click.BOOL,
|
||||
default=True,
|
||||
help=
|
||||
"Raise deckhand exception on missing substition sources. Defaults to True."
|
||||
)
|
||||
|
||||
|
||||
@stub.command('global', help='Add global structure for a new revision')
|
||||
@RELEASE_OPTION
|
||||
def global_(*, revision):
|
||||
engine.stub.global_(revision)
|
||||
|
||||
|
||||
@stub.command(help='Add a new site + revision')
|
||||
@click.argument('site_name')
|
||||
@RELEASE_OPTION
|
||||
@SITE_TYPE_OPTION
|
||||
def site(*, revision, site_type, site_name):
|
||||
engine.stub.site(revision, site_type, site_name)
|
||||
|
||||
|
||||
@stub.command('site-type', help='Add a new site-type + revision')
|
||||
@RELEASE_OPTION
|
||||
@SITE_TYPE_OPTION
|
||||
def site_type(*, revision, site_type):
|
||||
engine.stub.site_type(revision, site_type)
|
||||
|
||||
|
||||
def _lint(*, fail_on_missing_sub_src, exclude_lint, warn_lint):
|
||||
warns = engine.lint.full(fail_on_missing_sub_src, exclude_lint, warn_lint)
|
||||
if warns:
|
||||
|
@ -16,4 +16,3 @@
|
||||
from . import lint
|
||||
from . import repository
|
||||
from . import site
|
||||
from . import stub
|
||||
|
@ -1,33 +0,0 @@
|
||||
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
|
||||
#
|
||||
# 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 pegleg.engine import util
|
||||
|
||||
__all__ = ['global_', 'site', 'site_type']
|
||||
|
||||
|
||||
def global_(revision):
|
||||
util.files.create_global_directories(revision)
|
||||
|
||||
|
||||
def site(revision, site_type, site_name):
|
||||
util.definition.create(
|
||||
revision=revision, site_name=site_name, site_type=site_type)
|
||||
params = util.definition.load_as_params(site_name)
|
||||
util.files.create_site_directories(**params)
|
||||
|
||||
|
||||
def site_type(revision, site_type):
|
||||
util.files.create_site_type_directories(
|
||||
revision=revision, site_type=site_type)
|
@ -20,7 +20,6 @@ from pegleg import config
|
||||
from . import files
|
||||
|
||||
__all__ = [
|
||||
'create',
|
||||
'load',
|
||||
'load_as_params',
|
||||
'path',
|
||||
@ -30,26 +29,6 @@ __all__ = [
|
||||
]
|
||||
|
||||
|
||||
def create(*, site_name, site_type, revision):
|
||||
definition = {
|
||||
'schema': 'pegleg/SiteDefinition/v1',
|
||||
'metadata': {
|
||||
'schema': 'metadata/Document/v1',
|
||||
'name': site_name,
|
||||
'storagePolicy': 'cleartext',
|
||||
'layeringDefinition': {
|
||||
'abstract': False,
|
||||
'layer': 'site',
|
||||
},
|
||||
},
|
||||
'data': {
|
||||
'revision': revision,
|
||||
'site_type': site_type,
|
||||
}
|
||||
}
|
||||
files.dump(path(site_name), definition)
|
||||
|
||||
|
||||
def load(site, primary_repo_base=None):
|
||||
return files.slurp(path(site, primary_repo_base))
|
||||
|
||||
|
@ -49,15 +49,21 @@ def all():
|
||||
|
||||
|
||||
def create_global_directories():
|
||||
# NOTE(felipemonteiro): Currently unused. Needed by old "stub" CLI command.
|
||||
# Keeping this around because this utility may have future value.
|
||||
_create_tree(_global_root_path())
|
||||
_create_tree(_global_common_path())
|
||||
|
||||
|
||||
def create_site_directories(*, site_name, **_kwargs):
|
||||
# NOTE(felipemonteiro): Currently unused. Needed by old "stub" CLI command.
|
||||
# Keeping this around because this utility may have future value.
|
||||
_create_tree(_site_path(site_name))
|
||||
|
||||
|
||||
def create_site_type_directories(*, site_type):
|
||||
# NOTE(felipemonteiro): Currently unused. Needed by old "stub" CLI command.
|
||||
# Keeping this around because this utility may have future value.
|
||||
_create_tree(_site_type_common_path(site_type))
|
||||
_create_tree(_site_type_root_path(site_type))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user