opitzconsulting / ansible-oracle

Please use the upstream at oravirt for Pull-Requests and Issues
MIT License
15 stars 5 forks source link

module oracle_services.py: "Error modifying service" in Single Instance environment #174

Closed mapausch closed 7 months ago

mapausch commented 8 months ago

in ensure_service_state() the lists _wanted_ai and _wanted_pi get initialized with one element of empty string

_wanted_ai = ['']
_wanted_pi = ['']

In non-RAC environments (where "preferred instances" and "available instances" are not possible) the function _get_service_config() returns empty lists _curr_config_inst_ai[] and _curr_config_inst_pi[] .

Due to this, the comparisons are always "false" in non-RAC:

        if _wanted_pi != _curr_config_pi:
            _inst_temp += ' -preferred %s' % (preferred_instances)
        if _wanted_ai != _curr_config_ai and '' not in _wanted_ai:
            _inst_temp += ' -available %s' % (available_instances)

So ensure_service_config() builds commands like "srvctl modify service -d MyDB1 -s MYDBSERVICE -modifyconfig -preferred None", which is invalid in non-RAC environments and leads to

fatal: [mydbmachine]: FAILED! => {"changed": false, "msg": "Error modifying service. Command: /u01/app/oracle/product/19/db_1/bin/srvctl modify service -d MyDB1 -s MYDBSERVICE -modifyconfig -preferred None, stdout: PRKO-2002 : Invalid command line option: -modifyconfig\nPRKO-2002 : Invalid command line option: -preferred\n, stderr:

I modified the python code in https://github.com/mapausch/opitz-ansible-oracle/blob/master/plugins/modules/oracle_services.py In my Single Instance environment this works, but don't have a RAC environment for testing :-(

mapausch commented 7 months ago

referring to https://github.com/opitzconsulting/ansible-oracle/issues/113 :-)