Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing resource when dropping a datastore #4340

Closed
janette opened this issue Nov 12, 2024 · 4 comments · Fixed by #4343 or #4355
Closed

Handle missing resource when dropping a datastore #4340

janette opened this issue Nov 12, 2024 · 4 comments · Fixed by #4343 or #4355
Assignees
Labels

Comments

@janette
Copy link
Member

janette commented Nov 12, 2024

Current Behavior

Error when running drush dkan:datastore:drop when the resource is missing

 TypeError: Drupal\datastore\Events\DatastoreEventBase::__construct(): Argument #1 ($data_resource) must be of type Drupal\common\DataResource, null given, called in /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/DatastoreService.php on line 275 in Drupal\datastore\Events\DatastoreEventBase->__construct() (line 26 of /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/Events/DatastoreEventBase.php) #0 /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/DatastoreService.php(275): Drupal\datastore\Events\DatastoreEventBase->__construct(NULL)
#1 /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/Drush.php(227): Drupal\datastore\DatastoreService->drop('4b8a081fe9af7c3...', NULL, true)
#2 [internal function]: Drupal\datastore\Drush->drop('4b8a081fe9af7c3...', Array)
#3 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#4 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#6 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#7 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#14 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#15 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
#16 {main}.

Expected Behavior

User should see a message that that no resource could be found.

Steps To Reproduce

  1. Run dkan:datastore:drop on a resource id
  2. Run it a second time
  3. Confirm you see the error above

Relevant log output (optional)

No response

Anything else?

No response

@janette janette added bug Good First Issue good issues for first time contributors labels Nov 12, 2024
@paul-m paul-m linked a pull request Nov 17, 2024 that will close this issue
3 tasks
@paul-m
Copy link
Contributor

paul-m commented Nov 17, 2024

I ran into this where I used the Datasets admin form to delete a whole bunch of Data nodes, and then ran cron.

Added a PR to avoid the error, but it probably speaks more to some other area where subsystems are out of sync wrt deleted nodes.

@paul-m paul-m self-assigned this Nov 17, 2024
@paul-m
Copy link
Contributor

paul-m commented Dec 9, 2024

This is back after #4351

@paul-m paul-m reopened this Dec 9, 2024
@dafeder
Copy link
Member

dafeder commented Dec 9, 2024

Hmm looks like we should have added a test in #4343?

@paul-m
Copy link
Contributor

paul-m commented Dec 9, 2024

yupyup.

@paul-m paul-m removed the Good First Issue good issues for first time contributors label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants