Virtualization Plugins

 View Only
  • 1.  Passing in dynamic values as env variables to run_bash?

    Posted 01-15-2020 05:48:00 PM
    Having an issue sending values entered in the UI (i.e. virtual_source.paramaters.mount_location) to run_bash as environment vars.
    When I hard code (see below) it works fine.
    RunHostEnvVarHardCodedWorks

    But when I try to pass in a dynamic value based on the virtual_source (see below) I am getting errors when I try to create the VDB.
    RunBashWithEnvNotWorkingWhenTryToUseValueFromEnv
    DelphixUIErrorWhenRunBashEnvSetWithVarVals

    I looked on the Delphix SDK documentation but only saw an example with hard coded values, not variables.
    I looked online and tried a variety of things (i.e. import json, res=[], res.append({'SDK_INST': vdbinst}), etc, but failing as well.
    I'm relatively new to Python and need some guidance on how to do this.

    Thanks,

    Paul

    ------------------------------
    Paul Jauquet
    Senior Data Services Consultant
    Axis Technology, LLC
    ------------------------------


  • 2.  RE: Passing in dynamic values as env variables to run_bash?
    Best Answer

    Posted 01-15-2020 06:00:00 PM
    Hi Paul,

    Glad to see you're using the variables dictionary. That's a strange error. "scriptvarsjson" looks like a dictionary to me. A couple ideas come to mind:

    1) Make sure the values in the dictionary are strings. "port" is a likely culprit here. You can convert an integer (or anything) to a string using the built-in str method: "str(port)". You can get the type of a variables with the built-in type method: "type(port)"
    2) If that doesn't work, is it possible to remove elements in the dictionary one at a time and see which one is the causing issue?

    Let me know how it goes. 

    - Grant

    ------------------------------
    Grant Magdanz
    Senior Member of Technical Staff II
    Delphix
    ------------------------------



  • 3.  RE: Passing in dynamic values as env variables to run_bash?

    Posted 01-16-2020 09:07:00 AM
    Changing port to str(port) resolved it.   Thanks much!

    ------------------------------
    Paul Jauquet
    Senior Data Services Consultant
    Axis Technology, LLC
    ------------------------------