Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upon st2ctl reload (or restart), disabled sensors and rules are reenabled. #3016

Open
AndyMoore111 opened this issue Nov 10, 2016 · 4 comments

Comments

@AndyMoore111
Copy link

Sensors can be disabled, but not deleted. Upon st2ctl reload (or restart), disabled sensors are reenabled

If you delete the sensor yaml/py from disk, and reload, it still exists (enabled) in the sensor list

@humblearner
Copy link
Contributor

There are two different issues here:

  1. Upon st2ctl reload (or restart), disabled sensors and rules are reenabled.
  2. There is no CLI to delete or create sensors CLI Should have Create and Delete for sensors. #2877

We'll track this for one for the first.

@humblearner humblearner changed the title Sensors cannot be deleted Upon st2ctl reload (or restart), disabled sensors and rules are reenabled. Nov 14, 2016
@humblearner
Copy link
Contributor

This is a known issue. And will be fixed as part of content management.

@lakshmi-kannan
Copy link
Contributor

The problem today is that the CLI commands manipulate the models in db but not the YAML files on disk. Writing to files on disk via API is not a great thing. So we are punting the problem until we figure out our content management story which is basically how to load content into the system via files on disk (infra as code) and via APIs and keep them in sync when user switches from one to another.

If you want to disable sensors for good today, manipulate the YAML files on disk and then do st2ctl reload —register-all.

@humblearner
Copy link
Contributor

humblearner commented Nov 15, 2016

Example to disable a sensor:

vagrant@u14:~$ st2 sensor list
+-----------------------+-------+-----------------------------------------------------------------+---------+
| ref                   | pack  | description                                                     | enabled |
+-----------------------+-------+-----------------------------------------------------------------+---------+
| email.IMAPSensor      | email | Sensor that emits triggers when e-mail message is received via  | True    |
|                       |       | IMAP                                                            |         |
| email.SMTPSensor      | email | Sensor that emits triggers when e-mail message is received via  | True    |
|                       |       | SMTP                                                            |         |
+-----------------------+-------+-----------------------------------------------------------------+---------+

Edit: /opt/stackstorm/packs/email/sensors/smtp_sensor.yaml and add enabled: false:

---
class_name: "SMTPSensor"
entry_point: "smtp_sensor.py"
description: "Sensor that emits triggers when e-mail message is received via SMTP"
enabled: false
trigger_types:
  -
    name: smtp.message
    description: "An e-mail receieved via the SMTP sensor"
    payload_info:
      - from
      - to
      - html
      - subject
      - date
      - body_plain
      - body_html
      - attachments
      - headers
  1. st2ctl reload results in:
vagrant@u14:~$ st2 sensor list
+-----------------------+-------+-----------------------------------------------------------------+---------+
| ref                   | pack  | description                                                     | enabled |
+-----------------------+-------+-----------------------------------------------------------------+---------+
| email.IMAPSensor      | email | Sensor that emits triggers when e-mail message is received via  | True    |
|                       |       | IMAP                                                            |         |
| email.SMTPSensor      | email | Sensor that emits triggers when e-mail message is received via  | False   |
|                       |       | SMTP                                                            |         |
+-----------------------+-------+-----------------------------------------------------------------+---------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants