Virtualization Plugins

 View Only
  • 1.  How to pass parameters when running a script from the SDK

    Posted 01-10-2020 11:49:00 AM

    I was able to add a script under resources and run it from the SDK, but am having an issue trying to pass parameters to it?
    The example online does not show how you would pass in parameters based on the VDB that is being created. 

    I tried a few different ways without success.  Code from one of the attempts is below.

    Example of attempt to call script with parameters from SDK


    Would it be possible for you to give me an example that would call a script with positional parameters. 

    i.e. parsecnf.sh vdb1 /target/vdb1/msql 999
    Where vdb1 is the name of the VDB, /target/vdb1/msql is the mount point, and 9999 is the port for the VDB instance to listen on.

    Thanks!  Paul



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


  • 2.  RE: How to pass parameters when running a script from the SDK
    Best Answer

    Posted 01-10-2020 12:23:00 PM
    Hi Paul,

    Great question. This would be a good example to add to our docs. pkgutil.get_data reads the file in as a string so the entire bash script is being passed in as the command to run_bash. In your example, if you logged sdkscript it would log the entire contents of the script. You would use environment variables to pass parameters to your script. You can see some about how to use the "variables" parameter in the run_bash docs here. I hope this helps. Let me know if you have any other questions.

    - Grant

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