Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GF PF token replace
- // replaces all ProcFu auth tokens in all GlobiFlow flows
- input "auth token to search for" search_auth
- input "auth token to replace with" replace_auth
- input "enter 1 to replace or 0 to simulate" confirm_replace
- flows = gf_get_flows_list()
- replaced = 0
- // iterate through all flows
- foreach ( flows as flow ) {
- flow_id = flow.pkFlows
- print "fetching flow "+flow_id+" ("+flow.flowName+")"
- raw = gf_get_flow(flow_id, 0)
- changed = false
- // iterate through each flow step
- foreach ( raw.steps as i => fstep ) {
- if ( fstep.stepFunction <> "remotePost" ) continue
- ispf = stristr(fstep.stepDetails.values.url, "procfu")
- if ( not(ispf) ) continue
- hashead = stristr(fstep.stepDetails.values.headers, search_auth)
- if ( not(hashead) ) continue
- // HIT - we have a remote post step to PF with our auth token
- new_headers = str_replace(search_auth, replace_auth, raw.steps[i].stepDetails.values.headers)
- raw.steps[i]['stepDetails'].values.headers = new_headers
- changed = true
- replaced = replaced + 1
- print fstep
- }
- // if we changed the flow - re-save it
- if ( changed ) {
- if ( confirm_replace ) {
- print "flow has changed - re-saving"
- gf_save_flow(raw)
- } else {
- print "skipping save - here's what would have been saved"
- print raw
- }
- }
- }
- print "DONE"
- print "Replaced "+replaced+" tokens"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement