Hello All,
I am trying to attach data to an automatically created incident and then eventually send it to Pagerduty through playbooks. Some of the data in the incident requires certain environment variables in app.config to be passed along correctly. I am trying to create a local script in a sub-playbook that will take in the incident data, map it to certain environment variables, hold those in memory, pass it along to another part of the playbook which will finally send it to Pagerduty.
I understand the best way to grab data from app.config is described here(https://community.ibm.com/community/user/security/discussion/read-from-appconfig) specifically using an init which will grab the app config.
# __init__ method:
super(FunctionComponent, self).__init__(opts)
self.options = opts.get("your_package_name", {})
Another example described here(resilient-community-apps/fn_ldap_utilities/fn_ldap_utilities/util/ldap_utils.py at master · ibmresilient/resilient-community-apps)
However I cannot get it working correctly in my script. My code is simple
#Initialize to be able to read from app.config
class FunctionComponent():
def __init__(self, opts):
super(FunctionComponent, self).__init__(opts)
self.pagerduty_options = opts.get(CONFIG_DATA_SECTION, {})
self.log = logging.getLogger(__name__)
test = FunctionComponent(opts)
I know I am missing something simple here(i know there is no instantiation of opts, so i get a name error). Where does opts get instantiated in playbooks? How do i call that class in a playbook so i can read from app.config?
------------------------------
Nikolai Etholm
------------------------------