Hello.

I have a workaround which I think it's a little bit better
than all the things we've tried so far.

To debug this, I modified the postinst in this way:

-               /usr/share/openstack-dashboard/manage.py compress --force
+               if ! /usr/share/openstack-dashboard/manage.py compress --force; 
then
+                       curl -s -4 http://myserver.example.com/halted
+                       sleep 86400
+               fi

Then I can look at the nginx logs of myserver and see which of the
many ephemeral autobuilders has a real case to test.

To my surprise, the problem usually does not seem to happen
a second time, i.e. it may fail once and then succeed at the
second try. It seems purely random, which also means it could
fail a third time, etc,

So, I propose as a workaround that the compress process is simply
tried several times, as in the attached patch.

Note: I've actually tested the proposed patch and it works
for me: After trying to build each of the 18 affected packages
50 times (so, 900 builds in total), I got exactly zero build failures.

When the compress operation fails at first, this is reflected in the
build log in is way:

CommandError: An error occurred during rendering serial_console.html: Syntax 
error: Found 'inline-bl
o' but expected one of ADD, ALPHA_FUNCTION, BANG_IMPORTANT, BAREWORD, COLOR, 
DOUBLE_QUOTE, FNCT, IF_
FUNCTION, INTERP_START, LITERAL_FUNCTION, LPAR, NOT, NUM, SIGN, SINGLE_QUOTE, 
URL_FUNCTION, VAR

Compressing... Compress attempt 1 failed <----- fails here but it tries again

/usr/lib/python3/dist-packages/django/conf/__init__.py:267: 
RemovedInDjango50Warning: The USE_L10N setting is deprecated. Starting with 
Django 5.0, localized formatting of data will always be enabled. For example 
Django will display numbers and dates using the format of the current locale.
  warnings.warn(USE_L10N_DEPRECATED_MSG, RemovedInDjango50Warning)
/usr/lib/python3/dist-packages/debreach/__init__.py:6: DeprecationWarning: 
distutils Version classes are deprecated. Use packaging.version instead.
  version_info = version.StrictVersion(__version__).version
Compressing... done

Please note that in some cases I've also seen the compress operation
to fail twice and succeed at the third try, so it might be worth
to try several times, not just two.

I hope the attached patch is finally acceptable for you. I already tested it,
so feel free to use a Closes statement in the changelog if you adopt it.

Note: Maybe the "Compress" word can be removed from the string
so that it looks this way instead, a little bit nicer:

Compressing... attempt 1 failed

Thanks.
--- a/debian/openstack-dashboard.postinst
+++ b/debian/openstack-dashboard.postinst
@@ -10,7 +10,13 @@ rebuild_static() {
        # Compress the JS and CSS with python-compressor and python-lesscpy
        if [ -x /usr/share/openstack-dashboard/manage.py ] ; then
                /usr/share/openstack-dashboard/manage.py collectstatic 
--noinput --clear
-               /usr/share/openstack-dashboard/manage.py compress --force
+               for a in 1 2 3 4 5; do
+                       if /usr/share/openstack-dashboard/manage.py compress 
--force; then
+                               break
+                       else
+                               echo "Compress attempt ${a} failed"
+                       fi
+               done
        fi
 
        if [ -f /var/lib/openstack-dashboard/secret-key/.secret_key_store ]; 
then

Reply via email to