diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py b/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py index 6fce69e5399da9..6dd2bd819d4810 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/commands/create.py @@ -155,8 +155,9 @@ def _valid_template_description(): @click.option('--non-interactive', '-ni', is_flag=True, help='Disable prompting for fields') @click.option('--quiet', '-q', is_flag=True, help='Show less output') @click.option('--dry-run', '-n', is_flag=True, help='Only show what would be created') +@click.option('--skip-manifest', is_flag=True, help='Prevents validating the manfiest for check_only') @click.pass_context -def create(ctx, name, integration_type, location, non_interactive, quiet, dry_run): +def create(ctx, name, integration_type, location, non_interactive, quiet, dry_run, skip_manifest): """ Create scaffolding for a new integration. @@ -180,15 +181,16 @@ def create(ctx, name, integration_type, location, non_interactive, quiet, dry_ru manifest = {} # check_only is designed to already have content in it if integration_type == 'check_only': - if not os.path.exists(os.path.join(integration_dir, "manifest.json")): - abort(f"Expected {integration_dir}/manifest.json to exist") - # The existing integration folder already includes the author name, strip it out - with open(f"{integration_dir_name}/manifest.json", "r") as manifest: - manifest = json.loads(manifest.read()) - author = manifest.get("author", {}).get("name") - if author is None: - abort("Unable to determine author from manifest") - integration_dir_name = integration_dir_name.removeprefix(f"{author}_") + if not skip_manifest: + if not os.path.exists(os.path.join(integration_dir, "manifest.json")): + abort(f"Expected {integration_dir}/manifest.json to exist") + # The existing integration folder already includes the author name, strip it out + with open(f"{integration_dir_name}/manifest.json", "r") as manifest: + manifest = json.loads(manifest.read()) + author = manifest.get("author", {}).get("name") + if author is None: + abort("Unable to determine author from manifest") + integration_dir_name = integration_dir_name.removeprefix(f"{author}_") else: if os.path.exists(integration_dir): abort(f'Path `{integration_dir}` already exists!') diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/create.py b/datadog_checks_dev/datadog_checks/dev/tooling/create.py index 0fcb7cfb02faea..8ff4e8ab6cb9dc 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/create.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/create.py @@ -55,13 +55,17 @@ def get_valid_templates(): def prefill_template_fields_for_check_only(manifest: dict, normalized_integration_name: str) -> dict: author = manifest.get("author", {}).get("name") - check_name = normalize_package_name(f"{author}_{normalized_integration_name}") + check_name = normalize_package_name(f"{author}_{normalized_integration_name}") if author is not None else None return { - 'author_name': author, - 'check_name': check_name, - 'email': manifest.get("author", {}).get("support_email"), - 'homepage': manifest.get("author", {}).get("homepage"), - 'sales_email': manifest.get("author", {}).get("sales_email"), + k: v + for k, v in { + 'author_name': author, + 'check_name': check_name, + 'email': manifest.get("author", {}).get("support_email"), + 'homepage': manifest.get("author", {}).get("homepage"), + 'sales_email': manifest.get("author", {}).get("sales_email"), + }.items() + if v is not None }