ibm-mas / cli

Maximo Application Suite command line interface
https://ibm-mas.github.io/cli/
Eclipse Public License 2.0
20 stars 15 forks source link

mas uninstall - incorrect components were removed #1090

Closed rene-oromtz closed 2 days ago

rene-oromtz commented 4 days ago

CLI Version

IBM Maximo Application Suite Admin CLI v10.0.2

MAS CLI Input

3) Uninstall MAS Dependencies
Uninstall Certificate Manager? No
Uninstall MongoDb? Yes
Uninstall IBM Suite Licensing Service? Yes
Uninstall Grafana? NO
Uninstall IBM Catalog Source? no
Uninstall IBM Common Services? yes
Uninstall IBM User Data Services? yes

4) Review Settings
Instance ID ..................... cpst3
Uninstall Cert-Manager .......... False (redhat)
Uninstall Grafana ............... False
Uninstall IBM Operator Catalog .. False
Uninstall IBM Common Services ... True
Uninstall UDS ................... True
Uninstall MongoDb ............... False
Uninstall SLS ................... False

Expected Behaviour

MongoDB, Common-Services and UDS should have been removed along with MAS coomponents

Actual Behavior

Common-Services, UDS and IBM-Catalogs were removed from the cluster

Analysis

Two issues here:

  1. For Mongo/SLS, those weren't removed because it was specified as "Yes"

From mas-uninstall, only options for specifying an affirmative answers is y or yes uninstallMongoDb = prompt(HTML(f'<Yellow>Uninstall MongoDb? </Yellow>'), validator=YesNoValidator()) in ["y", "yes"] This is why the setting were set as False:

Uninstall MongoDb ............... False
Uninstall SLS ................... False

While there is warning showing the valid answers, this is not getting enforced as it takes "Yes" as a valid response. Possible enhancement is to either "lower" the response from customer or to add "Yes", "Y" as possible answers.

  1. Even when IBM Operator Catalog was set to False, it got uninstalled from cluster, for this, I'm not entirely sure which portion of the code is the one that is sending the wrong response to the pipelines:
    Uninstall IBM Operator Catalog .. False

    image

oc get catsrc -A
NAMESPACE               NAME                  DISPLAY               TYPE   PUBLISHER   AGE
openshift-marketplace   certified-operators   Certified Operators   grpc   Red Hat     21d
openshift-marketplace   community-operators   Community Operators   grpc   Red Hat     21d
openshift-marketplace   redhat-marketplace    Red Hat Marketplace   grpc   Red Hat     21d
openshift-marketplace   redhat-operators      Red Hat Operators     grpc   Red Hat     21d
rene-oromtz commented 4 days ago

I just found where the YesNoValidator is located, seems that right here it is allowing Y or Yes as a valid answer:

class YesNoValidator(Validator):
    def validate(self, document):
        """
        Validate that a response is understandable as a yes/no response
        """
        response = document.text
        if response.lower() not in ["y", "n", "yes", "no"]:
            raise ValidationError(message='Enter a valid response: y(es), n(o)', cursor_position=len(response))

However, like mentioned before, the Uninstall is only taking yes or y as valid

uninstallMongoDb = prompt(HTML(f'<Yellow>Uninstall MongoDb? </Yellow>'), validator=YesNoValidator()) in ["y", "yes"]
durera commented 3 days ago

Fix incoming ...

image

durera commented 2 days ago

Additional enhancements:

image

image

durera commented 2 days ago

In terms of the second issue raised .. I think they must have been related:

Selecting these options: image

Resulted in this pipeline configuration

  params:
    - name: mas_instance_id
      value: fvtstable
    - name: grafana_action
      value: none
    - name: cert_manager_provider
      value: redhat
    - name: cert_manager_action
      value: none
    - name: common_services_action
      value: none
    - name: ibm_catalogs_action
      value: none
    - name: mongodb_action
      value: none
    - name: sls_action
      value: none
    - name: uds_action
      value: none