MrMEEE / awx-build

145 stars 39 forks source link

6.1.0.155 to 6.1.0.246 upgrade failed: ImportError: Failed to initialize: Bad git executable. #143

Closed tjyang closed 5 years ago

tjyang commented 5 years ago

Hi @MrMEEE

sudo yum update --exclude ansible-awx sudo systemctl stop awx sudo yum install rh-git29 -y # new dependency on git from RH SCL repo. sudo yum install --disablerepo='' --enablerepo='mrmeee-ansible-awx, base' -x -debuginfo rh-python36* sudo yum update ansible-awx -y sudo -u awx scl enable rh-git29 rh-postgresql10 rh-python36 "awx-manage makemigrations"

* Error:

[me@awx01 ~]$ sudo -u awx scl enable rh-postgresql10 rh-python36 "awx-m anage makemigrations" Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/git/init.py ", line 83, in refresh() File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/git/init.py ", line 73, in refresh if not Git.refresh(path=path): File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/git/cmd.py", li ne 290, in refresh raise ImportError(err) ImportError: Bad git executable. The git executable must be specified in one of the following ways:

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the $GIT_PYTHON_REFRESH environment variable. Use one of the following values:

Example: export GIT_PYTHON_REFRESH=quiet

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/bin/awx-manage", line 11, in load_entry_point('awx==6.1.0', 'console_scripts', 'awx-manage')() File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/init.py ", line 142, in manage execute_from_command_line(sys.argv) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/man agement/init.py", line 381, in execute_from_command_line utility.execute() File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/man agement/init.py", line 357, in execute django.setup() File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/init .py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/apps/reg istry.py", line 114, in populate app_config.import_models() File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/apps/con fig.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/importlib/init.py", lin e 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/conf/models .py", line 11, in from awx.main.models.base import CreatedModifiedModel, prevent_search File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/models /init.py", line 176, in activity_stream_registrar.connect(Organization) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/regist rar.py", line 14, in connect from awx.main.signals import activity_stream_create, activity_stream_update, activity_stream_delete, activity_stream_associate File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/signal s.py", line 43, in from awx.main.tasks import update_inventory_computed_fields File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/tasks. py", line 47, in import git File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/git/init.py ", line 85, in raise ImportError('Failed to initialize: {0}'.format(exc)) ImportError: Failed to initialize: Bad git executable. The git executable must be specified in one of the following ways:

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the $GIT_PYTHON_REFRESH environment variable. Use one of the following values:

Example: export GIT_PYTHON_REFRESH=quiet

[me@awx01 ~]$


* Reference:
   R1: https://stackoverflow.com/questions/53474936/i-would-like-to-ask-how-to-solve-this-problem
MrMEEE commented 5 years ago

Thanks.. I will look into it later..

MrMEEE commented 5 years ago

I'm not sure that the new git is needed.. have you tried:

sudo -u awx scl enable rh-postgresql10 rh-python36 "GIT_PYTHON_GIT_EXECUTABLE=/usr/bin/git awx-manage migrate"
kyklos commented 5 years ago

I'm sorry, but that doesn't seem to help.

sudo -u awx scl enable rh-postgresql10 rh-python36 "GIT_PYTHON_GIT_EXECUTABLE=/bin/git awx-manage migrate"
Operations to perform:
  Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit
Running migrations:
  Applying main.0083_v360_job_branch_override...Traceback (most recent call last):
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column "scm_refspec" of relation "main_project" already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/rh/rh-python36/root/usr/bin/awx-manage", line 11, in <module>
    load_entry_point('awx==6.1.0', 'console_scripts', 'awx-manage')()
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/__init__.py", line 142, in manage
    execute_from_command_line(sys.argv)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 112, in database_forwards
    field,
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 447, in add_field
    self.execute(sql, params)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 137, in execute
    cursor.execute(sql, params)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "scm_refspec" of relation "main_project" already exists
tjyang commented 5 years ago

I tried both following commands and ended up with same git error.

MrMEEE commented 5 years ago

What output did you get from the sql command??

tjyang commented 5 years ago

I don't remember exactly the output of sql command but it went ok.

[me@awx01 ~]$ sudo -u awx scl enable rh-postgresql10 rh-python36 "GIT_PYTHON_REFRESH=quiet GIT_PYTHON_GIT_EXECUTABLE=/opt/rh/rh-git29/root/bin/git awx-manage migrate"
Operations to perform:
  Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit
Running migrations:
  Applying main.0083_v360_job_branch_override... OK
  Applying main.0084_v360_token_description... OK
[me@awx01 ~]$
MrMEEE commented 5 years ago

hmmm.. not even the admin account?

tjyang commented 5 years ago

I will try admin account later soon.

MrMEEE commented 5 years ago

@kyklos https://www.awx.wiki/upgrade/workarounds

kyklos commented 5 years ago

@MrMEEE Thank you, Martin.

GIT_PYTHON_REFRESH=quiet was necessary for me like sudo -u awx scl enable rh-postgresql10 rh-python36 rh-git29 "export GIT_PYTHON_REFRESH=quiet && awx-manage makemigrations"

MrMEEE commented 5 years ago

Ok.. thanks for the feedback @kyklos .. I will add it to the docs..

tjyang commented 5 years ago
MrMEEE commented 5 years ago

@tjyang Thanks for the feedback