Skip to content

Extension generator post_gen_project hook script #8316

@L-Har

Description

@L-Har

CKAN version

Source install from Development Master Branch
Python version 3.10.12

Describe the bug

Following the Creating a new extension procedure results in an error.

Steps to reproduce

Follow "Creating a new extension" after a source install.

Expected behavior

Extension generator works for both approaches - using either cookiecutter or ckan generate extension

Additional details

After running cookiecutter ckan/contrib/cookiecutter/ckan_extension/

Traceback (most recent call last):
  File "/tmp/tmp5k0l23t4.py", line 88, in <module>
    "_checkout": null,
NameError: name 'null' is not defined
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

After running ckan generate extension

Traceback (most recent call last):
  File "/tmp/tmp0_491klm.py", line 88, in <module>
    "_checkout": null,
NameError: name 'null' is not defined
Stopping generation because post_gen_project hook script didn't exit successfully
Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/ckan", line 8, in <module>
    sys.exit(ckan())
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/lh/ckan/lib/default/src/ckan/ckan/cli/generate.py", line 114, in extension
    cookiecutter(template_loc, no_input=True, extra_context=context,
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/cookiecutter/main.py", line 182, in cookiecutter
    result = generate_files(
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/cookiecutter/generate.py", line 419, in generate_files
    run_hook_from_repo_dir(
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/cookiecutter/hooks.py", line 157, in run_hook_from_repo_dir
    run_hook(hook_name, project_dir, context)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/cookiecutter/hooks.py", line 140, in run_hook
    run_script_with_context(script, project_dir, context)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/cookiecutter/hooks.py", line 123, in run_script_with_context
    run_script(temp.name, cwd)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/cookiecutter/hooks.py", line 94, in run_script
    raise FailedHookException(
cookiecutter.exceptions.FailedHookException: Hook script failed (exit status: 1)

I tried using the patch found #5610 and it didn't work for me. I also made sure cookiecutter is the one installed in the virtual environment and not the global one.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions