Skip to content

Is there a way to access an attachment file from within the action (alias) ? #5642

Answered by fti-lit
fti-lit asked this question in ChatOps
Discussion options

You must be logged in to vote

I managed to find the url in the mongodb, using ctx().st2.action_execution_id as a parameter:

def run(self, idexec):
    # get connection informations
    username = quote_plus(getattr(cfg.CONF.database, "username", None))
    password = quote_plus(getattr(cfg.CONF.database, "password", None))
    db_name = cfg.CONF.database.db_name
    db_host = cfg.CONF.database.host
    db_port = cfg.CONF.database.port
    try:
        mdb = pymongo.MongoClient('mongodb://%s:%s@%s:%s/%s' % (username, password, db_host, db_port, db_name))
    except Exception as inst:
        print("Login failed")
        return (False, {"message": "Failed mongodb login"})
    stdb = mdb.st2
    collectionkvp = stdb.act…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fti-lit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant