Skip to content

Commit

Permalink
Merge pull request #167 from guidograzioli/add_web_origin_parameter
Browse files Browse the repository at this point in the history
Add `web_origin` parameter to `activemq_facts` module
  • Loading branch information
guidograzioli authored Sep 5, 2024
2 parents d267e0f + 676bb52 commit ff26378
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/modules/activemq_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
- Verify TLS certificates when using https.
type: bool
default: true
web_origin:
description:
- The value to use in the Origin header for the http request
type: str
required: false
default: http://0.0.0.0
connection_timeout:
description:
- Controls the HTTP connections timeout period in seconds to jolokia API.
Expand Down Expand Up @@ -113,6 +119,7 @@ def __init__(self, module):
self.baseurl = self.module.params.get('base_url')
self.broker = self.module.params.get('broker_name')
self.validate_certs = self.module.params.get('validate_certs')
self.web_origin = self.module.params.get('web_origin')
self.connection_timeout = self.module.params.get('connection_timeout')
self.auth_username = self.module.params.get('auth_username')
self.auth_password = self.module.params.get('auth_password')
Expand All @@ -130,7 +137,7 @@ def gather_facts(self):

restheaders = {}
restheaders["Authorization"] = basic_auth_header(self.auth_username, self.auth_password)
restheaders['Origin'] = self.baseurl if 'localhost' not in self.baseurl else 'https://0.0.0.0'
restheaders["Origin"] = self.web_origin

try:
return json.loads(to_native(open_url(jolokia_url, method='GET',
Expand Down Expand Up @@ -164,6 +171,7 @@ def amq_argument_spec():
auth_username=dict(type='str', aliases=['username'], required=True),
auth_password=dict(type='str', aliases=['password'], required=True, no_log=True),
validate_certs=dict(type='bool', default=True),
web_origin=dict(type='str', required=False, default="http://0.0.0.0", no_log=False),
connection_timeout=dict(type='int', default=10)
)

Expand Down

0 comments on commit ff26378

Please sign in to comment.