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

Generate Service Image Action not triggered by migration #4

Closed
seth-shaw-unlv opened this issue May 4, 2018 · 9 comments
Closed

Generate Service Image Action not triggered by migration #4

seth-shaw-unlv opened this issue May 4, 2018 · 9 comments

Comments

@seth-shaw-unlv
Copy link
Owner

Running the migration results in UNLV Images with Media Files tagged as Preservation Masters but this doesn't trigger the generate_a_service_file_from_preservation_master action. This requires us to manually select the migrated content items in the UI and initiate the action after the migration completes. Hardly ideal.

@seth-shaw-unlv
Copy link
Owner Author

Gathering resources.

@seth-shaw-unlv
Copy link
Owner Author

Ack, it also isn't triggering Fedora and triple-store indexing....

@seth-shaw-unlv
Copy link
Owner Author

I may have been barking up the wrong tree. The milliner log (/logs/islandora/milliner.log) starts displaying a lot of errors when the current migration configuration runs. So, events are being triggered, but not properly.

E.g. (sans JWT auth entries, which were all successful)

[2018-05-08 17:47:06] app.INFO: Matched route "{route}". {"route":"POST_content","route_parameters":{"_controller":"milliner.controller:saveContent","_route":"POST_content"},"request_uri":"http://localhost:8000/milliner/content","method":"POST"} []
[2018-05-08 17:47:06] app.DEBUG: > POST /milliner/content [] []
[2018-05-08 17:47:06] app.DEBUG: Gemini POST response {"uuid":"8399745d-9003-4d8b-aef1-6c47cdff2fcc","response":"[object] (GuzzleHttp\\Psr7\\Response: {})"} []
[2018-05-08 17:47:07] app.DEBUG: Gemini PUT response {"uuid":"8399745d-9003-4d8b-aef1-6c47cdff2fcc","response":"[object] (GuzzleHttp\\Psr7\\Response: {})"} []
[2018-05-08 17:47:07] app.DEBUG: < 201 [] []
[2018-05-08 17:47:36] app.INFO: Matched route "{route}". {"route":"POST_file","route_parameters":{"_controller":"milliner.controller:saveFile","_route":"POST_file"},"request_uri":"http://localhost:8000/milliner/file","method":"POST"} []
[2018-05-08 17:47:36] app.DEBUG: > POST /milliner/file [] []
[2018-05-08 17:47:36] app.DEBUG: Gemini POST response {"uuid":"8b0f10fa-de6c-4f23-9cb3-0789f3ff0d93","response":"[object] (GuzzleHttp\\Psr7\\Response: {})"} []
[2018-05-08 17:47:37] app.DEBUG: Gemini PUT response {"uuid":"8b0f10fa-de6c-4f23-9cb3-0789f3ff0d93","response":"[object] (GuzzleHttp\\Psr7\\Response: {})"} []
[2018-05-08 17:47:37] app.DEBUG: < 201 [] []
[2018-05-08 17:48:02] app.INFO: Matched route "{route}". {"route":"POST_media","route_parameters":{"_controller":"milliner.controller:saveMedia","_route":"POST_media"},"request_uri":"http://localhost:8000/milliner/media","method":"POST"} []
[2018-05-08 17:48:02] app.DEBUG: > POST /milliner/media [] []
[2018-05-08 17:48:02] app.ERROR:  {"Exception":"[object] (GuzzleHttp\\Exception\\ClientException(code: 404): Client error: `GET http://localhost:8000/media/15?_format=json` resulted in a `404 Not Found` response:\n{\"message\":\"The \\u0022media\\u0022 parameter was not converted for the path \\u0022\\/media\\/{media}\\u0022 (route name: \\u0 (truncated...)\n at /var/www/html/Crayfish/Milliner/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)"} []
[2018-05-08 17:48:02] app.DEBUG: < 404 [] []

Note that the Gemini calls in these entries don't actually work.

Needs more debugging.

@seth-shaw-unlv
Copy link
Owner Author

Discovered that drush doesn't automatically pull in the site URI which caused the emitted events to have the wrong URL. Running drush with the option -l http://localhost:8000 solves that part.

More testing to come.

@seth-shaw-unlv
Copy link
Owner Author

Derivatives are being generated by Houdini, but are not getting saved back to Drupal when using Drush. It is probably related to how AuthenticationGuardToken is being set. Migrations run when logged in as admin will show in the houdini log (/var/log/islandora/houdini.log) as:

Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken: PostAuthenticationGuardToken(user=\"admin\", authenticated=true, roles=\"authenticated, administrator\"))","authenticator":"Islandora\\Crayfish\\Commons\\Syn\\JwtAuthenticator"} []

But when using drush the PostAuthenticationGuardToken part will change to:

(user=\"\", authenticated=true, roles=\"anonymous\")

@seth-shaw-unlv
Copy link
Owner Author

Drush used to have a user switch to run commands as another user, but it was removed. A thread recommends using AccountSwitcher, but it isn't clear to me how to use it. I attempted to use the AccountSwitcher in a Migrate PreImport Event subscriber, but that didn't appear to work (the Tokens didn't change).

seth-shaw-unlv added a commit that referenced this issue May 15, 2018
Switches the user running the migration to the one indicated, necessary for JWT authentication to work for generating derivatives.

Resolves #4
@seth-shaw-unlv
Copy link
Owner Author

I finally got AccountSwitcher to work using a drush pre-command. The UserSession constructor needs the uid, name, and roles for the JWT auth to work. (UserSession doesn't infer the other properties from the uid.)

seth-shaw-unlv added a commit that referenced this issue May 15, 2018
Resolves #4 generate derivatives when using drush
@seth-shaw-unlv
Copy link
Owner Author

Image generation isn't working on a stock claw_playbook. Reopening the issue although I probably won't do anything with it for the time being since users can successfully trigger derivatives using the UI Content page.

@seth-shaw-unlv
Copy link
Owner Author

Actually, it is creating them. Perhaps I didn't give it enough time to process last time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant