Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
eb778c9
Update affected tests.
Kami Jan 3, 2019
6452f4d
Fix two issues in FileWatchSensor:
Kami Jan 7, 2019
106dd08
Fix validate_trigger_payload() method so it also works if a trigger
Kami Jan 7, 2019
1f34a18
Update inaccurate comment.
Kami Jan 7, 2019
ab2e356
Determine if the trigger_type_ref is actually a trigger ref based if the
Kami Jan 7, 2019
35244de
Add a test case for it.
Kami Jan 7, 2019
7f6e602
Fix RabbitMQ connection retry wrapper so it doesn't block for
Kami Jan 22, 2019
3be3891
Make max retries configurable, also log sleep interval.
Kami Jan 22, 2019
7b92b68
Remove debug code.
Kami Jan 22, 2019
5535d13
Pin pyyaml to latest version.
Kami Jan 22, 2019
ba36fc2
Re-generate requirements file and use our flex work which doesn't pin
Kami Jan 22, 2019
4a6ace4
Also update pyyaml in test requirements.
Kami Jan 22, 2019
205dbb2
Update requirements to PyYAML >=4.2b,<5.2 and a possible bump to flex
blag Jan 30, 2019
5b4dedd
Use flex v6.14.0
blag Feb 12, 2019
88392cc
Remove redundant action-aliases for pack install. Fix st2 action-alia…
nmaludy Jan 23, 2019
bbf6cd7
Supress statsd library debug log messages in sensor container when DEBUG
Kami Jan 24, 2019
3207e7f
Pull in coverage change.
Kami Feb 18, 2019
7922447
Update code so we don't submit metrics for any "get one" API endpoints
Kami Jan 24, 2019
a5c58ce
Make the if check more robust.
Kami Jan 24, 2019
139f742
Make the if check more robust.
Kami Jan 24, 2019
9a87a69
Fix assert in get_sandbox_python_path. Make sure it also works correctly
Kami Jan 24, 2019
fbf4846
Upgrade python-gnupg dependency because of a security vulnerability
Kami Jan 27, 2019
13c39e9
Re-generate requirements files.
Kami Jan 27, 2019
ed11c45
Fix "cryptography_symmetric_encrypt" function and make sure we correctly
Kami Jan 31, 2019
430943e
Add changelog entry for #4528.
Kami Jan 31, 2019
6684b96
Fix a bug in Orquesta runner and workflow engine and make sure we add
Kami Feb 4, 2019
bf7763a
Make the log message more useful when debugging.
Kami Feb 4, 2019
61cd45a
For consistency between tests and actual end to end runner code, make
Kami Feb 4, 2019
c36b3b9
Update orquesta tests to verify that pack is indeed present in the
Kami Feb 4, 2019
a2685d9
Add orquesta test which verifies "{{ config_context }}" notation for
Kami Feb 4, 2019
3e127c4
Fix a bug with "serialize_positional_argument" not correctly handling
Kami Feb 4, 2019
7700b2a
Add a changelog entry for #4533.
Kami Feb 4, 2019
7298d81
Return early on None value.
Kami Feb 4, 2019
5e834b5
Try forcing UTF-8 charset in the email.
Kami Feb 5, 2019
e3330d1
Update the parameter documentation.
Kami Feb 5, 2019
33c0f39
Add changelog entry.
Kami Feb 5, 2019
9bdd32f
UTF-8 encode both body and subject of email
Feb 5, 2019
dca4c75
base64 encode subject
Feb 5, 2019
7ce54c6
Update changelog entry.
Kami Feb 5, 2019
e6a9e93
Add some unit / integration tests for sendmail action.
Kami Feb 5, 2019
26cd17e
We now also need stanley user for pack tests step.
Kami Feb 5, 2019
6e50096
Make test more robust and not depend on the static hostname value.
Kami Feb 5, 2019
4cdd07c
Fix out of date build job name.
Kami Feb 5, 2019
4f3ab9e
Add some metric instrumentation to the notifer service code.
Kami Feb 5, 2019
bb51209
Don't submit metric if we don't post generic notify trigger so we don't
Kami Feb 5, 2019
313591c
In those cases we are only interested in timing information.
Kami Feb 6, 2019
056f9be
Move lock for concurrency policies into scheduler
m4dcoder Feb 6, 2019
d607c4f
Use count instead of len when querying if action has policies
m4dcoder Feb 6, 2019
0fdef30
Remove commented out code from coordination service
m4dcoder Feb 6, 2019
9d490ec
Update service_setup service entry / bootstrap code so we exclude log
Kami Feb 6, 2019
cbf9289
Add an integration test case which verifies that service setup log level
Kami Feb 6, 2019
dbfc25d
Use longer sleep to avoid false negatives.
Kami Feb 6, 2019
ffd5fa0
Fix Python 3 compatibility.
Kami Feb 6, 2019
1c2c9e8
Fix accidental regression in pylint Makefile check.
Kami Feb 8, 2019
cc1c23b
Fix syntax so PYTHONPATH is set correctly.
Kami Feb 10, 2019
ddcf5bd
Fix invalid / broken comparison.
Kami Feb 7, 2019
0ecb226
Add support for client side certificate authentication and verifying
Kami Feb 8, 2019
1349143
Fix typo.
Kami Feb 11, 2019
da65b3d
Add tests for "_get_ssl_kwargs" function which we were missing.
Kami Feb 11, 2019
76b63c7
Add tests for st2common.transport.utils._get_ssl_kwargs function.
Kami Feb 11, 2019
9b7dba0
Update help string.
Kami Feb 11, 2019
01cb47d
Re-generate sample config.
Kami Feb 11, 2019
8bf195f
Fix typos.
Kami Feb 11, 2019
b76ae85
Fix a default value.
Kami Feb 11, 2019
b959df1
Update more affected code.
Kami Feb 11, 2019
6594525
Simplify the code - URL and connection management is now centralized so
Kami Feb 11, 2019
5b5bd6d
Add CA, server cert and client cert which can be used for testing.
Kami Feb 12, 2019
fe237c5
Update Travis config so we configure RabbitMQ so it exposes SSL / TLS
Kami Feb 12, 2019
fd0c7b1
Add a workaround - for now we are stuck on Ubuntu Precise and ancient
Kami Feb 12, 2019
cd88c9f
Update tests config.
Kami Feb 12, 2019
ed4fe11
Add tests for RabbitMQ connection SSL related parameters and RabbitMQ
Kami Feb 12, 2019
7e471f5
Add commented out RabbitMQ ssl related config options which users can
Kami Feb 12, 2019
42e77e0
Try installing latest version of erlang and rabbitmq-server package.
Kami Feb 12, 2019
d8271f2
Revert the change, those versions won't work on Precise.
Kami Feb 12, 2019
1450d71
Temporary disable tests since they don't work on Travis due to us using
Kami Feb 12, 2019
ec3a8b4
Fix API 'POST /api/v1/apikeys' wasn't creating new record with the pr…
Feb 8, 2019
e56d0ac
Add ID's to apikey fixtures
Feb 12, 2019
4d8f8c9
Add 'ID' for POST API creation test case
Feb 12, 2019
26c4e92
Fix a typo in older tests
Feb 12, 2019
905f878
Refactor scheduler process to exit properly
m4dcoder Feb 11, 2019
86ae007
Add missing license header.
Kami Feb 12, 2019
059d3e1
Fix function name.
Kami Feb 12, 2019
ef9f3fe
Add a test case for scheduler correctly exiting on handler and
Kami Feb 12, 2019
c635bea
Make binaries executable.
Kami Feb 12, 2019
6fb90d8
Update tests.
Kami Feb 12, 2019
6bf0705
Regenerated the sample st2 config
m4dcoder Feb 12, 2019
62c56c1
Add unit test to cover the handler cleanup
m4dcoder Feb 12, 2019
83ad994
Add unit tests to cover the retries in scheduler handler
m4dcoder Feb 12, 2019
ee07d93
Fix scheduler test configs in unit tests
m4dcoder Feb 13, 2019
0ebe0c8
Include the scheduler retry and exit code fix in changelog
m4dcoder Feb 13, 2019
0f11aeb
Update orquesta to version 0.4
m4dcoder Feb 15, 2019
e49134f
Fix fibonacci sensor intger overflow by resetting self.a and self.b if
Kami Dec 14, 2018
bf18247
Add log statement.
Kami Dec 14, 2018
2d91cba
Fix / update changelog file.
Kami Feb 18, 2019
5701b22
Revert changes which are targeted for v3.0.0 and not v2.10.2 release.
Kami Feb 18, 2019
015a328
Add missing entry for flex to fixed-requirements.txt and regenerate
Kami Feb 18, 2019
f88d9b8
Add a checkrequirements make target and integrate it into Travis tests
blag Feb 15, 2019
a684e41
Simplify some make logic
blag Feb 16, 2019
2e73b81
Use latest travis config from master.
Kami Feb 18, 2019
582cd69
Log a message when we are sleeping due to the rabbitmq connection error.
Kami Jan 21, 2019
af7b0f2
Fix the if check.
Kami Jan 21, 2019
a1bdb5d
Add a test case for it.
Kami Jan 21, 2019
027bf21
Pass missing argument to the method.
Kami Jan 21, 2019
e5d4817
Add missing changelog entries, reorganize some existing entries and put
Kami Feb 18, 2019
60fcf80
Fix failing tests.
Kami Feb 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 35 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Used old infrastructure, needed for integration tests:
# http://docs.travis-ci.com/user/workers/standard-infrastructure/
sudo: required
# NOTE: We use precise because tests finish faster than on Xenial
dist: precise
language: python

Expand Down Expand Up @@ -55,13 +56,30 @@ matrix:
name: "Lint Checks, Packs Tests (Python 2.7)"
- env: TASK="compilepy3 ci-py3-unit" CACHE_NAME=py3 COMMAND_THRESHOLD=680
python: 3.6
name: "Unit Tests (Python 3.6)"
name: "Unit Tests, Pack Tests (Python 3.6)"
- env: TASK="ci-py3-integration" CACHE_NAME=py3 COMMAND_THRESHOLD=310
python: 3.6
name: "Integration Tests (Python 3.6)"

services:
- rabbitmq
addons:
apt:
sources:
- mongodb-upstart
- sourceline: 'deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse'
key_url: 'https://www.mongodb.org/static/pgp/server-3.4.asc'
# NOTE: Precise repo doesn't contain Erlang 20.x, latest version is 19.x so we need to use RabbitMQ 3.7.6
#- sourceline: 'deb [arch=amd64] http://packages.erlang-solutions.com/ubuntu precise contrib'
# key_url: 'https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc'
#- sourceline: 'deb [arch=amd64] https://dl.bintray.com/rabbitmq/debian precise rabbitmq-server-v3.6.x'
# key_url: 'https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc'
- sourceline: 'ppa:git-core/ppa'
packages:
- mongodb-org-server
- mongodb-org-shell
- erlang
- rabbitmq-server
- git
- libffi-dev

cache:
pip: true
Expand All @@ -76,39 +94,39 @@ cache:
#- .tox/

before_install:
# 1. Install MongoDB 3.4 and latest version of git
- sudo add-apt-repository -y ppa:git-core/ppa
- curl https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add -
- echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee -a /etc/apt/sources.list
# Work around for Travis timeout issues, see https://github.com/travis-ci/travis-ci/issues/9112
- sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60"
- sudo apt-get install mongodb-org-server mongodb-org-shell git libffi-dev -y
# Work around for apt Travis timeout issues, see https://github.com/travis-ci/travis-ci/issues/9112
#- sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60"
- pip install --upgrade "pip>=9.0,<9.1"
- sudo pip install --upgrade "virtualenv==15.1.0"

install:
- ./scripts/travis/install-requirements.sh
- if [ "${TASK}" = 'ci-unit' ] || [ "${TASK}" = 'ci-integration' ] || [ "${TASK}" = 'compilepy3 ci-py3-unit' ] || [ "${TASK}" = 'ci-py3-integration' ]; then sudo .circle/add-itest-user.sh; fi
- if [ "${TASK}" = 'ci-unit' ] || [ "${TASK}" = 'ci-integration' ] || [ "${TASK}" = 'ci-checks ci-packs-tests' ] || [ "${TASK}" = 'compilepy3 ci-py3-unit' ] || [ "${TASK}" = 'ci-py3-integration' ]; then sudo .circle/add-itest-user.sh; fi

# Let's enable rabbitmqadmin
# See https://github.com/messagebus/lapine/wiki/Testing-on-Travis.
before_script:
# key_url no longer works for APT addon
# Use a custom mongod.conf which uses various speed optimizations
- sudo cp scripts/travis/mongod.conf /etc/mongod.conf
# Clean up any old MongoDB 3.4 data files laying around and make sure mongodb user can write to it
- sudo rm -rf /var/lib/mongodb ; sudo mkdir /var/lib/mongodb ; sudo chown -R mongodb:mongodb /var/lib/mongodb
- sudo service mongod restart ; sleep 5
- sudo service mongod status
- tail -30 /var/log/mongodb/mongod.log
- mongod --version
- git --version
- pip --version
- virtualenv --version
- sudo tail -n 30 /var/log/mongodb/mongod.log
# Use custom RabbitMQ config which enables SSL / TLS listener on port 5671 with test certs
- sudo cp scripts/travis/rabbitmq.config /etc/rabbitmq/rabbitmq.config
# Install rabbitmq_management RabbitMQ plugin
- sudo service rabbitmq-server restart ; sleep 5
- sudo rabbitmq-plugins enable rabbitmq_management
- sudo wget http://guest:guest@localhost:15672/cli/rabbitmqadmin -O /usr/local/bin/rabbitmqadmin
- sudo chmod +x /usr/local/bin/rabbitmqadmin
- sudo service rabbitmq-server restart
- sudo tail -n 30 /var/log/rabbitmq/*
# Print various binary versions
- mongod --version
- git --version
- pip --version
- virtualenv --version
# Print out various environment variables info
- make play

Expand Down
72 changes: 72 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,78 @@
Changelog
=========

in development
--------------

Added
~~~~~

* Add support for various new SSL / TLS related config options (``ssl_keyfile``, ``ssl_certfile``,
``ssl_ca_certs``, ``ssl_certfile``, ``authentication_mechanism``) to the ``messaging`` section in
``st2.conf`` config file.

With those config options, user can configure things such as client based certificate
authentication, client side verification of a server certificate against a specific CA bundle, etc.

NOTE: Those options are only supported when using a default and officially supported AMQP backend
with RabbitMQ server. (new feature) #4541
* Add metrics instrumentation to the ``st2notifier`` service. For the available / exposed metrics,
please refer to https://docs.stackstorm.com/reference/metrics.html. (improvement) #4536

Changed
~~~~~~~

* Update logging code so we exclude log messages with log level ``AUDIT`` from a default service
log file (e.g. ``st2api.log``). Log messages with level ``AUDIT`` are already logged in a
dedicated service audit log file (e.g. ``st2api.audit.log``) so there is no need for them to also
be duplicated and included in regular service log file.

NOTE: To aid with debugging, audit log messages are also included in a regular log file when log
level is set to ``DEBUG`` or ``system.debug`` config option is set to ``True``.

Reported by Nick Maludy. (improvement) #4538 #4502
* Update ``pyyaml`` dependency to the latest version. This latest version fixes an issue which
could result in a code execution vulnerability if code uses ``yaml.load`` in an unsafe manner
on untrusted input.

NOTE: StackStorm platform itself is not affected, because we already used ``yaml.safe_load``
everywhere.

Only custom packs which use ``yaml.load`` with non trusted user input could potentially be
affected. (improvement) #4510 #4552 #4554
* Update Orquesta to ``v0.4``. #4551

Fixed
~~~~~

* Fixed the ``packs.pack_install`` / ``!pack install {{ packs }}`` action-alias to not have
redundant patterns. Previously this prevented it from being executed via
``st2 action-alias execute 'pack install xxx'``. #4511

Contributed by Nick Maludy (Encore Technologies)
* Fix datastore value encryption and make sure it also works correctly for unicode (non-ascii)
values.

Reported by @dswebbthg, @nickbaum. (bug fix) #4513 #4527 #4528
* Fix a bug with action positional parameter serialization used in local and remote script runner
not working correctly with non-ascii (unicode) values.

This would prevent actions such as ``core.sendmail`` which utilize positional parameters from
working correctly when a unicode value was provided.

Reported by @johandahlberg (bug fix) #4533
* Fix ``core.sendmail`` action so it specifies ``charset=UTF-8`` in the ``Content-Type`` email
header. This way it works correctly when an email subject and / or body contains unicode data.

Reported by @johandahlberg (bug fix) #4533 4534
* Fix CLI ``st2 apikey load`` not being idempotent and API endpoint ``/api/v1/apikeys`` not
honoring desired ``ID`` for the new record creation. #4542
* Moved the lock from concurrency policies into the scheduler to fix a race condition when there
are multiple scheduler instances scheduling execution for action with concurrency policies.
#4481 (bug fix)
* Add retries to scheduler to handle temporary hiccup in DB connection. Refactor scheduler
service to return proper exit code when there is a failure. #4539 (bug fix)

2.10.1 - December 19, 2018
--------------------------

Expand Down
31 changes: 28 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ play:
@echo

.PHONY: check
check: requirements flake8 checklogs
check: check-requirements flake8 checklogs

# NOTE: We pass --no-deps to the script so we don't install all the
# package dependencies which are already installed as part of "requirements"
# make targets. This speeds up the build
.PHONY: install-runners
install-runners:
@echo ""
Expand All @@ -143,9 +146,18 @@ install-runners:
echo "==========================================================="; \
echo "Installing runner:" $$component; \
echo "==========================================================="; \
(. $(VIRTUALENV_DIR)/bin/activate; cd $$component; python setup.py develop); \
(. $(VIRTUALENV_DIR)/bin/activate; cd $$component; python setup.py develop --no-deps); \
done

.PHONY: check-requirements
check-requirements: requirements
@echo
@echo "============== CHECKING REQUIREMENTS =============="
@echo
# Update requirements and then make sure no files were changed
git status -- *requirements.txt */*requirements.txt | grep -q "nothing to commit"
@echo "All requirements files up-to-date!"

.PHONY: checklogs
checklogs:
@echo
Expand Down Expand Up @@ -175,6 +187,19 @@ configgen: requirements .configgen
@echo "================== pylint ===================="
@echo
# Lint st2 components
@for component in $(COMPONENTS); do\
echo "==========================================================="; \
echo "Running pylint on" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate ; pylint -j $(PYLINT_CONCURRENCY) -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models --load-plugins=pylint_plugins.db_models $$component/$$component || exit 1; \
done
# Lint runner modules and packages
@for component in $(COMPONENTS_RUNNERS); do\
echo "==========================================================="; \
echo "Running pylint on" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate ; pylint -j $(PYLINT_CONCURRENCY) -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models --load-plugins=pylint_plugins.db_models $$component/*.py || exit 1; \
done
# Lint Python pack management actions
. $(VIRTUALENV_DIR)/bin/activate; pylint -j $(PYLINT_CONCURRENCY) -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/packs/actions/*.py || exit 1;
. $(VIRTUALENV_DIR)/bin/activate; pylint -j $(PYLINT_CONCURRENCY) -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/packs/actions/*/*.py || exit 1;
Expand Down Expand Up @@ -827,7 +852,7 @@ debs:
ci: ci-checks ci-unit ci-integration ci-mistral ci-packs-tests

.PHONY: ci-checks
ci-checks: compile .generated-files-check .pylint .flake8 .bandit .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check
ci-checks: compile .generated-files-check .pylint .flake8 check-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check

.PHONY: ci-py3-unit
ci-py3-unit:
Expand Down
32 changes: 24 additions & 8 deletions conf/st2.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,26 @@ mask_secrets_blacklist = # comma separated list allowed here.
mask_secrets = True

[messaging]
# URL of the messaging server.
url = amqp://guest:guest@127.0.0.1:5672//
# How long should we wait between connection retries.
connection_retry_wait = 10000
# Certificate file used to identify the local connection (client).
ssl_certfile = None
# How many times should we retry connection before failing.
connection_retries = 10
# Use SSL / TLS to connect to the messaging server. Same as appending "?ssl=true" at the end of the connection URL string.
ssl = False
# URL of the messaging server.
url = amqp://guest:guest@127.0.0.1:5672//
# Specifies whether a certificate is required from the other side of the connection, and whether it will be validated if provided.
ssl_cert_reqs = None
# URL of all the nodes in a messaging service cluster.
cluster_urls = # comma separated list allowed here.
# How long should we wait between connection retries.
connection_retry_wait = 10000
# Private keyfile used to identify the local connection against RabbitMQ.
ssl_keyfile = None
# ca_certs file contains a set of concatenated CA certificates, which are used to validate certificates passed from RabbitMQ.
ssl_ca_certs = None
# Login method to use (AMQPLAIN, PLAIN, EXTERNAL, etc.).
login_method = None

[metrics]
# Randomly sample and only send metrics for X% of metric operations to the backend. Default value of 1 means no sampling is done and all the metrics are sent to the backend. E.g. 0.1 would mean 10% of operations are sampled.
Expand Down Expand Up @@ -249,14 +261,18 @@ thread_pool_size = 10
logging = /etc/st2/logging.rulesengine.conf

[scheduler]
# How long (in seconds) to sleep between each action scheduler main loop run interval.
sleep_interval = 0.1
# How often (in seconds) to look for zombie execution requests before rescheduling them.
gc_interval = 10
# The maximum number of attempts that the scheduler retries on error.
retry_max_attempt = 10
# Location of the logging configuration file.
logging = /etc/st2/logging.scheduler.conf
# How long (in seconds) to sleep between each action scheduler main loop run interval.
sleep_interval = 0.1
# The size of the pool used by the scheduler for scheduling executions.
pool_size = 10
# The number of milliseconds to wait in between retries.
retry_wait_msec = 3000
# How often (in seconds) to look for zombie execution requests before rescheduling them.
gc_interval = 10

[schema]
# Version of JSON schema to use.
Expand Down
9 changes: 8 additions & 1 deletion conf/st2.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ ssh_key_file = /home/vagrant/.ssh/stanley_rsa

[messaging]
url = amqp://guest:guest@127.0.0.1:5672/
#url = redis://localhost:6379/0
# Uncomment to test SSL options
#url = amqp://guest:guest@127.0.0.1:5671/
#ssl = True
#ssl_keyfile = /data/stanley/st2tests/st2tests/fixtures/ssl_certs/client/private_key.pem
#ssl_certfile = /data/stanley/st2tests/st2tests/fixtures/ssl_certs/client/client_certificate.pem
#ssl_ca_certs = /data/stanley/st2tests/st2tests/fixtures/ssl_certs/ca/ca_certificate_bundle.pem
#ssl_cert_reqs = required
#ssl_cert_reqs = required

[ssh_runner]
remote_dir = /tmp
Expand Down
31 changes: 22 additions & 9 deletions contrib/core/actions/send_mail/send_mail
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@
HOSTNAME=$(hostname -f)
LINE_BREAK=""

SENDMAIL=`which sendmail`
if [ $? -ne 0 ]; then
echo "Unable to find sendmail binary in PATH" >&2
exit 2
FOOTER="This message was generated by StackStorm action `basename $0` running on `hostname`"

# Allow user to provide a custom sendmail binary for more flexibility and easier
# testing
SENDMAIL_BINARY=$1

if [ "${SENDMAIL_BINARY}" = "None" ]; then
# If path to the sendmail binary is not provided, try to find one in $PATH
SENDMAIL=`which sendmail`

if [ $? -ne 0 ]; then
echo "Unable to find sendmail binary in PATH" >&2
exit 2
fi

MAIL="$SENDMAIL -t"
else
MAIL="${SENDMAIL_BINARY}"
fi
shift

MAIL="$SENDMAIL -t"
FOOTER="This message was generated by StackStorm action `basename $0` running on `hostname`"
if [[ $1 =~ '@' ]]; then
FROM=$1
else
Expand Down Expand Up @@ -52,7 +65,7 @@ if [[ -z $trimmed && $SEND_EMPTY_BODY -eq 1 ]] || [[ -n $trimmed ]]; then
cat <<EOF
TO: ${TO}
FROM: ${FROM}
SUBJECT: ${SUBJECT}
SUBJECT: =?UTF-8?B?$(echo ${SUBJECT} | base64)?=
EOF

if [[ -n $ATTACHMENTS ]]; then
Expand Down Expand Up @@ -83,7 +96,7 @@ EOF

cat <<EOF
--${boundary}
Content-Type: ${CONTENT_TYPE}
Content-Type: ${CONTENT_TYPE}; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Expand All @@ -92,7 +105,7 @@ EOF
else

cat <<EOF
Content-Type: ${CONTENT_TYPE}
Content-Type: ${CONTENT_TYPE}; charset=UTF-8

EOF

Expand Down
Loading