update_categories fails

I just attempted a rebuild per @merefield s request and the rebuild (migrate) crashed because of an error in update_categories

        5: from /var/www/discourse/plugins/discourse-plugin-manager/lib/plugin_manager/plugin.rb:180:in `block in update_associations'
        4: from /var/www/discourse/plugins/discourse-plugin-manager/lib/plugin_manager/plugin.rb:303:in `update_categories'
        3: from /var/www/discourse/plugins/discourse-plugin-manager/lib/plugin_manager/plugin.rb:303:in `each'
        2: from /var/www/discourse/plugins/discourse-plugin-manager/lib/plugin_manager/plugin.rb:308:in `block in update_categories'
        1: from /var/www/discourse/plugins/discourse-plugin-manager/lib/plugin_manager/plugin.rb:324:in `update_category'

I currently have no time to look into this and/or correct any errors, so I have commented out the PMS from app.yml for now.

Some thoughts

  • We should avoid running this code on rebuild. It’s now always called from lines 66-73 in plugin.rb. Maybe fence it with if Discourse.running_in_rack?
  • We should avoid running this code synchroneously
  • We should fence it with a rescue block

@angus would you be able to fix this today? If not I can do it tomorrow or Wednesday. Either option is fine with me.

Sure, I’ll take a look today.

1 Like

This is addressed in this PR. I’ll merge and deploy tonight.

The code is removed entirely as it’s not necessary in the way we’re now using the plugin manager.

Note that the branch is currently deployed in test.pavilion.tech if anyone wishes to review.

1 Like

I didn’t test but looked at the PR - the changes look good, except for one question:

  • I see you removed the template that copies the files but I don’t see a replacement for that logic?

This is deployed. The plugin manager no longer uses pups templates and can be deployed like any other plugin. The plugin guard still does (and needs to).

1 Like