Symptoms

While performing the RHEL6->RHEL7 migration procedure for the BA DB node, the error is faced:

# python el6_ba_migrate.py --db=192.0.2.2 --backup
...
Exception: Internal error: /bin/sh /bin/sh -c rpm -ql postgresql96-server | grep /postmaster$ failed with code 1 saying: STDOUT:

The source BA DB host does not appear to have PostgreSQL server version 9.6 installed:

[root@bmdb ~]# rpm -qa | grep postgres | grep 9.6
[root@bmdb ~]#

The required hotfixes are installed.

Full error output:

2017-07-21 21:30:20.816 [DEBUG] ['/usr/local/pem/bin/pleskd_ctl', '-f', '/usr/local/pem/etc/pleskd.props', '-s', '223', 'processHCL', '/tmp/tmpJ1nkc6', '387'] exited with non-zero status 1, stderr: DEBUG [ processHCL] ===> ENTRY
DEBUG [ processHCL] <=== EXIT (by exception) [0.196672]
Exception !
ERROR [ HCL Process] ExSystem: module_id:'Common', ex_type_id:'1',Message:'Internal error: /bin/sh /bin/sh -c rpm -ql postgresql96-server | grep /postmaster$ failed with code 1 saying: STDOUT: '' STDERR ''.', deprecated_codes = (0, 0), properties = { reason: '/bin/sh /bin/sh -c rpm -ql postgresql96-server | grep /postmaster$ failed with code 1 saying: STDOUT: '' STDERR ''', }
, stdout:
2017-07-21 21:30:20.816 [DEBUG] <-- finished run [#387] rpm -ql postgresql96-server | grep /postmaster$ valid_exit_codes=[0] stderr=stderr stdout=stdout [00.246]
2017-07-21 21:30:20.816 [DEBUG] Error trace:
2017-07-21 21:30:20.849 [DEBUG] Traceback (most recent call last):
  File "/root/el6_ba_migration/poaupdater/uAction.py", line 122, in fn
    return fun(*args, **kwds)
  File "el6_ba_migrate.py", line 580, in migrate_db
    __import__("postgresql-migrator").migrate_billing_db(runner)
  File "/root/el6_ba_migration/postgresql-migrator.py", line 62, in migrate_billing_db
    migrate_db(command_executor = runHCLCmd, host_role="Billing DB", db_host=db_host, granted_ips=granted_ips)
  File "/root/el6_ba_migration/postgresql-migrator.py", line 27, in migrate_db
    uLinux.upgradeDatabase(ConfigForUpgrade96(command_executor), None, granted_ips_cooked)
  File "/root/el6_ba_migration/poaupdater/uLinux.py", line 749, in upgradeDatabase
    pgsqlNext = uPgSQL.PostgreSQLConfig(version = trgVer, commander = run)
  File "/root/el6_ba_migration/poaupdater/uPgSQL.py", line 125, in __init__
    self.__binDir = _1stLine(self.__run("rpm -ql postgresql%s-server | grep /postmaster$" % ("".join(self.__ver.split(".")),)))
  File "/root/el6_ba_migration/postgresql-migrator.py", line 56, in runHCLCmd
    o = command_executor(commandText, stdout='stdout', stderr='stderr', valid_exit_codes=[0])["stdout"]
  File "el6_ba_migrate.py", line 50, in action
    return fn(*args, **kwargs)
  File "el6_ba_migrate.py", line 578, in runner
    return self.src.run(*args, **kwargs)
  File "el6_ba_migrate.py", line 63, in action
    return fn(*args, **kwargs)
  File "el6_ba_migrate.py", line 214, in run
    raise Exception(get_hcl_err_msg(e.err))
Exception: Internal error: /bin/sh /bin/sh -c rpm -ql postgresql96-server | grep /postmaster$ failed with code 1 saying: STDOUT:

Cause

After installing KB130373 hotfix, required for the migration, the action to update billing was not performed.

Resolution

Complete the Billing update:

# /usr/local/pem/bin/pa_updates_installer --update-billing

Retry the migration.

Internal content