# How can I prevent installs when a Preflight Check fails

**URL:** <https://community.replicated.com/t/how-can-i-prevent-installs-when-a-preflight-check-fails/763>\
**Category:** How do I?\
**Tags:** kots, troubleshoot\
**Created:** [April 11, 2022, 5:35pm UTC](https://community.replicated.com/t/how-can-i-prevent-installs-when-a-preflight-check-fails/763 "2022-04-11T17:35:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando\_Cremer](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/fernando_cremer/32/436_2.png) [@Fernando\_Cremer](https://community.replicated.com/u/Fernando_Cremer)\
**Post date:** [April 11, 2022, 5:35pm UTC](https://community.replicated.com/t/how-can-i-prevent-installs-when-a-preflight-check-fails/763/1 "2022-04-11T17:35:32Z")

</div>

In the [0.30.0 release](https://github.com/replicatedhq/troubleshoot/releases/tag/v0.30.0) of Troubleshoot and [version 1.67](https://docs.replicated.com/release-notes/rn-app-manager#1670) of App Manager, we added a [new property](https://troubleshoot.sh/docs/analyze/#strict) called `strict` to analyzers. When this is set to `true` and the Analyzer fails, it will block the deployment of the application. This applies to new installs as well as to updates.

Take the following preflight check:

```nohighlight
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
metadata:
  name: example-preflight-checks
spec:
  analyzers:
    - containerRuntime:
        outcomes:
          - pass:
              when: "== containerd"
              message: ContainerD container runtime was found.
          - fail:
              message: Did not find ContainerD container runtime.

```

In the above example, if we run the preflight on a cluster that does not have `containerd` as the Container Runtime Interface (CRI) it will fail. However, you would be able to continue and deploy the application.

If we modify it by adding the `strict` shared property as shown below, the deployment is blocked.

```nohighlight
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
metadata:
  name: example-preflight-checks
spec:
  analyzers:
    - containerRuntime:
        strict: true
        outcomes:
          - pass:
              when: "== containerd"
              message: ContainerD container runtime was found.
          - fail:
              message: Did not find ContainerD container runtime.

```

There may be some instances in which you may want to set the `strict` property to `true` only under certain conditions. For example, during a POC, or when deploying to a test environment, we may not want to block the deployment even if the analyzer fails.

To accomplish this, use [template functions](https://docs.replicated.com/reference/template-functions-about). There are [several available](https://docs.replicated.com/reference/template-functions-about) that allow you to use runtime values in your manifests.

In this example, we are going to use information about the [license](https://docs.replicated.com/reference/template-functions-license-context), specifically the license type:

```nohighlight
apiVersion: troubleshoot.replicated.com/v1beta1
kind: Preflight
metadata:
  name: example-preflight-checks
spec:
  analyzers:
    - containerRuntime:
        strict: 'repl{{ eq (LicenseFieldValue "licenseType") "prod" }}'
        outcomes:
          - pass:
              when: "== containerd"
              message: ContainerD container runtime was found.
          - fail:
              message: Did not find ContainerD container runtime.

```
