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

feat: Add support for SSL certification requirements in Redis connection #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log: `robotframework-redislibrary`
================================

## Version 1.2.8
**Date:** 13-Nov-2024
- allow override param ssl_cert_reqs to Connect To Redis keyword

## Version 1.2.7
**Date:** 01-Oct-2024
- Update travis python 3.7 to 3.9
Expand Down
8 changes: 6 additions & 2 deletions RedisLibrary/RedisLibraryKeywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def get_redis_master(self, redis_host, redis_port=26379, service_name=None):
return sentinel_detail

@keyword('Connect To Redis')
def connect_to_redis(self, redis_host, redis_port=6379, db=0, redis_password=None, ssl=False, ssl_ca_certs=None):
def connect_to_redis(self, redis_host, redis_port=6379, db=0, redis_password=None, ssl=False, ssl_ca_certs=None,
ssl_cert_reqs="required"):
"""Connect to the Redis server.

Arguments:
Expand All @@ -68,15 +69,18 @@ def connect_to_redis(self, redis_host, redis_port=6379, db=0, redis_password=Non
- redis_password: password for Redis authentication
- ssl: Connect Redis with SSL or not (default is False)
- ssl_ca_certs: CA Certification when connect Redis with SSL
- ssl_cert_reqs: SSL certification requirements (default is required)

Return redis connection object

Examples:
| ${redis_conn}= | Connect To Redis | redis-dev.com | 6379 | redis_password=password |
| ${redis_conn}= | Connect To Redis | redis-dev.com | 6379 | redis_password=password | ssl=True | ssl_cert_reqs=None |
"""
try:
redis_conn = redis.StrictRedis(host=redis_host, port=redis_port, db=db,
password=redis_password, ssl=ssl, ssl_ca_certs=ssl_ca_certs)
password=redis_password, ssl=ssl, ssl_ca_certs=ssl_ca_certs,
ssl_cert_reqs=ssl_cert_reqs)
except Exception as ex:
logger.error(str(ex))
raise Exception(str(ex))
Expand Down
2 changes: 1 addition & 1 deletion RedisLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Update this before release
VERSION = "1.2.7"
VERSION = "1.2.8"
4 changes: 2 additions & 2 deletions docs/RedisLibrary.html

Large diffs are not rendered by default.