Remove

The remove command applies changes to the host system as specified in the manifest. The purpose of the remove command is to uninstall configuration from a host system.

Consider the example manifest below:

{
  "name": "example",
  "version": "0.0.1",
  "metadata": {
    "gene_system": {
      "version": "0.3.2"
    }
  },
  "steps": [
    {
      "name": "install awscli",
      "exe": {
        "remove": {
          "cmd": [
            "brew remove awscli"
          ]
        },
        "remove": {
          "cmd": [
            "brew remove awscli"
          ]
        }
      },
      "tags": "example step"
    }
  ]
}

Running the remove command like this:

genesystem remove --manfest /path/to/manifest.json

Will execute the remove commands in step sequence. Returning to the above example, this would run brew remove awscli.

If the --manifest flag is not provided, you’ll be prompted for a path to the manifest:

Please enter the path to the configuration manifest (manifest.json)

By default it will pick a manifest.json file in the current directory.

Filtering Steps

It is possible to either include or exclude steps using the step tags.

For example if from the following example:

{
  "name": "example",
  "version": "0.0.1",
  "metadata": {
    "gene_system": {
      "version": "0.3.2"
    }
  },
  "steps": [
     {
      "name": "install awscli",
      "exe": {
        "install": {
          "skip": "brew ls --version awscli",
          "cmd": [
            "brew install awscli"
          ]
        },
        "remove": {
          "cmd": [
            "brew remove awscli"
          ]
        }
      },
      "tags": "example install awscli"
    },
    {
      "name": "install libxml",
      "exe": {
        "install": {
          "skip": "brew ls --version libxml",
          "cmd": [
            "brew install libxml"
          ]
        },
        "remove": {
          "cmd": [
            "brew remove libxml"
          ]
        }
      },
      "tags": "example install libxml"
    },
    {
      "name": "install libssl",
      "exe": {
        "install": {
          "skip": "brew ls --version libssl",
          "cmd": [
            "brew install libssl"
          ]
        },
        "remove": {
          "cmd": [
            "brew remove libssl"
          ]
        }
      },
      "tags": "install libssl"
    }
  ]
}

We only want to remove awscli you can use the --include-tags option on the install command like this:

genesystem remove --include-tags awscli

The inverse operation is --exclude-tags and works in the opposite way, where steps with the provided tags are excluded from the run. So if we were wanting to skip removing awscli, that could be achieved thus:

genesystem remove --exclude-tags awscli

You may choose to specify 1 tag or many in both --include-tags or --exclude-tags, each tag is specified in a space delimited list:

genesystem remove --include-tags example awscli

Finally it is possible to include and then exclude. Just note that the inclusion is executed first, that is useful if you want to reject steps from a smaller set of steps.

genesystem remove --include-tags example --exclude-tags awscli