Bench error on update to v7.1

Migrating site1.local
Executing frappe.patches.v7_1.setup_integration_services #2016-09-16 in site1.local (1bd3e0294d)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 209, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 30, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 83, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/patches/v7_1/setup_integration_services.py", line 21, in execute
    setup_integration_service(app_details)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/patches/v7_1/setup_integration_services.py", line 33, in setup_integration_service
    settings = get_app_settings(app_details)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/patches/v7_1/setup_integration_services.py", line 60, in get_app_settings
    for d in controller.parameters_template:
AttributeError: 'PayPalSettings' object has no attribute 'parameters_template'

I had an issue with AttributeError: 'DocType' object has no attribute 'engine' before, ran bench migrate and got this error, then ran bench update and get the full error above repeatedly.

I think the error has to do with [fix] refactor integration services by saurabh6790 · Pull Request #2087 · frappe/frappe · GitHub
That code removed the parameters_template field, but the patch that came with the original integration services merge (v7_1/setup_integration_services.py) wasn’t updated.

I have hacked the code so that the installation went forward, but I don’t know the downstream repercussions. Here’s what I did (which allowed me to complete the update):

In the patch (v7_1/setup_integration_services.py):
change the get_app_settings method (starting at line 49) to the following:

def get_app_settings(app_details):
	from frappe.integration_broker.doctype.integration_service.integration_service import get_integration_controller

	parameters = {}
	doctype = docname = app_details["doctype"]

	app_settings = get_parameters(app_details)
	settings = app_settings["settings"]
	try:
		controller = get_integration_controller(app_details["service_name"])
	except:
		pass
	#for d in controller.parameters_template:
	#	if settings.get(d.fieldname):
	#		if ''.join(set(settings.get(d.fieldname))) == '*':
	#			setattr(settings, d.fieldname, get_decrypted_password(doctype, docname, d.fieldname, raise_exception=True))

	#		parameters.update({d.fieldname : settings.get(d.fieldname)})

	return parameters

Once again, this is what I did to allow bench to update without error. I do NOT recommend this for anyone else, so do it at your own risk. I’m guessing there could be issues using the integration services (dropbox, paypal, razorpay) but there could be other issues as well. Hopefully a proper fix will come shortly.

1 Like

Hey thanks for reporting issue will fix this asps.

1 Like

ok i am not sure i want to do that. How do I revert back to the latest 7.0.x?

I went to:
apps/frappe/frappe/patches.txt
and deleted line 60 which reads:
frappe.patches.v7_1.setup_integration_services #2016-09-16
then bench migrate/update works fine.

Then uninstalled/removed paypal_integration via bench and then reinstalled paypal integration via bench.
All appears to be working

Fixing via [fix] restructure setup integration service patch by saurabh6790 · Pull Request #2215 · frappe/frappe · GitHub

Hi, we tried this but still we are getting the same error :frowning: