- Removes the hard-coded magic number of 60 seconds allowing users to
choose the period that they require.
- Standardise on strings for DictOpt dict keys. When loaded from a config
file, the DictOpt keys are parsed as strings, which was conflicting with
the default integer dict keys. This caused the periodic engine to silently
fail to load when configured via a config file.
- Remove unused variable
Story: 2006783
Task: 37313
Change-Id: Ibd61c45fc1ade37022150d34a5b00c56fdf69814
* Set max line length to 100
* Clean up code for pep8 checks
Change-Id: Ie00dc204f522fb2112f02f4151ec8a15d5523459
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
Change upgrades the monasca-notification to leverage
the capabilities of both oslo.log and oslo.conf:
- configuration of logging separated from application settings
- ability to enforce data types for application settings
- ability to use oslo.config-generator capabilities
- automatic configuration parsing done by oslo.cfg
That change will bring it closer to the rest of monasca
components where such transition has happened already.
However, in the rest of monasca, oslo.cfg was partially
or fully implemented whereas monasca-notification has
been relying on YAML based configuration file.
Therefore backward compatybility for such format will
be kept for now.
Story: 2000959
Task: 4093
Task: 4092
Change-Id: Ia75c3b60d0fada854178f21ca5ccb9e6a880f37f
Georgia-Anna Farmaki found the import of logging.config to be
required. I see the same thing while testing. I should have
tested instead of just inspecting this code when I approved
Ibd2f64f464af1f501d45c43c0f438f5c74027f6c.
Change-Id: If73576882cf29588d6a4b395b04b3168ff2b84ea
Add adjustments:
- read configuration file in binary mode
- remove extra encoding
- check if string is binary class and convert it to
standard string
Change-Id: I5f73b6b0e8b5592539e07fe66debf917540ce24c
Story: 2001124
Task: 4816
Absolute paths are required for importing modules.
Python3 cannot find modules if absolute paths are not used.
Change-Id: Id060f269bfb1d17ccad844451678359e664386fa
This commit silences monasca-notifications in situations where
it cannot write to its log file due to ENOSPC by preventing
the logging module from raising exceptions (recommended best
practice for production use).
The old behaviour can be restored by setting the
logging/raise_exceptions setting in the configuration file to
True (defaults to False).
Change-Id: Idbe5bdf56fb280412c34f04de8f2e2f301a7a432
Story: 2001089
Task: 4749
Add bandit job as part of pep8 in tox.ini
Had to mark two instances of try except pass as OK so that bandit
will pass
Change-Id: If3b78e9dcbfc65c232a6ba35665430a6463841e6
Avoid dangerous file parsing and object serialization libraries.
yaml.load is the obvious function to use but it is dangerous[1]
Because yaml.load return Python object may be dangerous if you
receive a YAML document from an untrusted source such as the Internet.
The function yaml.safe_load limits this ability to simple Python
objects like integers or lists.
In addition, Bandit flags yaml.load() as security risk so replace
all occurrences with yaml.safe_load(). Thus I replace yaml.load()
with yaml.safe_load()
[1] https://security.openstack.org/guidelines/dg_avoid-dangerous-input-parsing-libraries.html
Change-Id: I3f1a756e80b617ba1bcf824ef4dee9a27eb6887a
Closes-Bug: #1634265
New periodic notification engine that will take a notification send it, and then
place it back onto the periodic notification topic. Once the alarm associated
with the notification has transitioned to a state that is different from the
original state the notification is removed from the queue.
Change-Id: Ie3103a0ec30abcd8dfc53869b1c3135953aabf3a
Here is an obvious misspelling : "proccess_type", which should be "process_type"
This may confuse others.
So I changed all the "proccess_type" to "process_type"
Change-Id: If9844b4141c030a41ce2ab8f9983b760bcd6a9ae
Squished the notification down to one process in preparation for making
multiple engine instances able to talk to the same topic.
Added HA capabilities to the KafkaConsumer object.
Change-Id: Id4799d690c7caf10ae7ba89c2d4e0aeb76c54375
Added more test coverage for email notifications.
Moved notification methods from notification_processor to new types directory.
types/interface.py now automatically records statsd information for configured
types.
Configuration for a type is now optional. Uncofigured types are not able to
send notifications. Notifications that come across for unconfigured types
generate a warning.
Email notification type now explicity exits when unable to connect to an SMTP
server.
Change-Id: I213d815965761736eb3680b5e14206ba7bef7e90
Added a timeout keyword to requests.post that we use to send webhooks. Updated
the tests to verify that the webhook will properly time out.
Change-Id: I27140a8c13afcd8f2e30ea1367f0bd9f4944ba36
With kafka 0.8.1 it is now possible for non-java clients to track
offsets with kafka. Previously the code had built this using zookeeper.
This relies on kafka-python > 0.9.1
Change-Id: Ia42e713cc5d9ca61d8f8df2adc454f1e2579a229
Removed manual tests which are no longer valid with a modern mini-mon
Removed debian creation bits all distribution is with pypi now
Minor pep8 fixes
Change-Id: I1f2fc4d0ad6375f4c39446f9627247945066e4ad