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

With all-sites, some errors are not visible #181

Open
mauritsvanrees opened this issue Oct 29, 2019 · 1 comment
Open

With all-sites, some errors are not visible #181

mauritsvanrees opened this issue Oct 29, 2019 · 1 comment

Comments

@mauritsvanrees
Copy link
Contributor

I tried this on a client project:

$ bin/upgrade install --all-sites --upgrades 5@zindex.website:default

The exit code ($?) was 1, so there was an error somewhere, but nothing was visible here, nor in the instance log. So I try it verbose:

$ bin/upgrade install --all-sites --verbose --upgrades 5@zindex.website:default
DEBUG urllib3.connectionpool: Starting new HTTP connection (1): localhost
DEBUG urllib3.connectionpool: http://localhost:8080 "GET /upgrades-api/list_plone_sites HTTP/1.1" 200 98
DEBUG urllib3.connectionpool: Starting new HTTP connection (1): localhost
DEBUG urllib3.connectionpool: http://localhost:8080 "POST /z-index/upgrades-api/execute_upgrades?upgrades%3Alist=5%40zindex.website%3Adefault HTTP/1.1" 400 135

Still an error, still nothing visible.
Then I specify a single Plone Site id (there is only one), and then I see a clear error:

$ bin/upgrade install --site z-index --upgrades 5@zindex.website:default
ERROR: Plone site outdated: The Plone site is outdated and needs to be upgraded first using the regular Plone upgrading tools.
> http://localhost:8080/z-index/upgrades-api/execute_upgrades?upgrades%3Alist=5%40zindex.website%3Adefault
< 400 Plone site outdated

So a specific site id (or --pick-site or --list-site) shows the error, but --all-sites does not show me anything.
Would this be fixable?

@deiferni
Copy link
Contributor

At first glance it seems that with --all-sites sys.stdout is captured 🤔. See

with capture() as out:
args.func(args)
output = out.getvalue().strip()
if getattr(args, 'json', False):
# "[]" must be turned into [] and put in dictionary.
output = json.loads(output)
info[args.picked_site] = output
else:
logger.info('Acting on site {0}'.format(
args.picked_site))
print(output)
. Maybe something in there is not working as intended?

Side-note: In case of only one plone site i personally would recommend --pick-site or the -S shorthand as that will fail if it unexpectedly encounters more than one site.

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

2 participants