diff --git a/pegleg/cli.py b/pegleg/cli.py index 3a14895e..d229a2b6 100644 --- a/pegleg/cli.py +++ b/pegleg/cli.py @@ -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: diff --git a/pegleg/engine/__init__.py b/pegleg/engine/__init__.py index b66d8160..05da87b8 100644 --- a/pegleg/engine/__init__.py +++ b/pegleg/engine/__init__.py @@ -16,4 +16,3 @@ from . import lint from . import repository from . import site -from . import stub diff --git a/pegleg/engine/stub.py b/pegleg/engine/stub.py deleted file mode 100644 index 63b8fd79..00000000 --- a/pegleg/engine/stub.py +++ /dev/null @@ -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) diff --git a/pegleg/engine/util/definition.py b/pegleg/engine/util/definition.py index 32bd3c0c..02d54bf9 100644 --- a/pegleg/engine/util/definition.py +++ b/pegleg/engine/util/definition.py @@ -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)) diff --git a/pegleg/engine/util/files.py b/pegleg/engine/util/files.py index efebcacc..2b421c64 100644 --- a/pegleg/engine/util/files.py +++ b/pegleg/engine/util/files.py @@ -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))