APIPythonOpen-Source Solutions

 View Only
  • 1.  Engine Upgrade

    Posted 06-24-2020 04:04:00 PM
    I would like to automate engine upgrade. First step is to upload the binaries, has anyone done this using python api call, if so-please share code.

    It should look something like this :
    obf = open(binary_file, 'rb')
    result = session.post(url+'/system/uploadUpgrade', file=obf, allow_redirects=False)
    obf.close()
    result_json = json.loads(result.text)
    if result_json['status'] != 'OK':
    raise Exception('Error Uploading Binary File')
    return result_json['result']
    But I am curious about the opening of the binary file and what the result of the api call will look like.

    Thanks

    ------------------------------
    Dafna Meyers

    ------------------------------


  • 2.  RE: Engine Upgrade

    Posted 07-02-2020 03:04:00 AM
    Hi Dafna,

    You have a snippet of curl code you can find here "https://docs.delphix.com/docs534/reference/web-service-api-guide/api-cookbook-common-tasks-workflows-and-examples/api-cookbook-uploadupgrade", this will allow you to check the result of the API call.

    Regarding the binary file will result in uploading the upgrade image to a specific directory into the engine, after while an automated routine will check it's presence and will check the image, uncompressed it, etc. until you get the verification step done.

    Regards,

    Mouhssine

    ------------------------------
    Mouhssine SAIDI
    Community Member
    Delphix Community Members
    ------------------------------



  • 3.  RE: Engine Upgrade

    Posted 07-02-2020 09:03:00 AM
    Hi Mouhssine,

    I've seen that link you attached. However I've been told that Running this api call in python is a bit different than in curl. Specifically with opening the binary file, how to include it in the api call-either file='open_binary_file' or file = {file='open_binary_file'}
    Once that api call is submitted, what is the expected output? 
    Is it necessary to check the status of the upload?

    ------------------------------
    Dafna Myers
    Assoc
    JPMorgan Chase
    ------------------------------



  • 4.  RE: Engine Upgrade

    Posted 07-13-2020 10:36:00 AM
    Edited by Ram Mullapudi 07-13-2020 10:36:54 AM
    Hi Dafna,

    Once the upgrade image is uploaded, verify version job will be auto started. You can get the result of this verify job using this API

    GET /resources/json/delphix/system/version/{ref}
    but you need to pass the reference of the version and that reference can be obtained using 

    GET /resources/json/delphix/system/version
    You can also run this verify job explicitly before running actual upgrade and API for this is

    POST /resources/json/delphix/system/version/{ref}/verify
    Finally you can run upgrade by running this API

    POST /resources/json/delphix/system/version/{ref}/apply


    Hope this helps.

    Best regards,

    ------------------------------
    Ram Mullapudi
    Delphix Support
    Delphix
    ------------------------------



  • 5.  RE: Engine Upgrade

    Posted 07-24-2020 01:52:00 PM
    Hi Dafna,

    The main idea from my understanding is to write a python script that help you automate the upgrade process.

    Let's break tasks as follow :

    1/ Check for the image filename to matching delphix upgrade pattern, because if the upgrade image isn't conforme with delphix standard the engine will not accept it
    2/ Get a connexion to the engine as SYSTEM user
    3/ You can set a control point if you're reuploading an existing image by checking the version from image file and calling this api "resources/json/delphix/system/version"
    4/ if step 3 is ok upload the image using this curl API call by passinfg the image file as parameter to it
    "/resources/json/system/uploadUpgrade"
    5/ keep looping on the job status to check if the upload is ok.

    You can take a look on how the api is called with python from the great delphixpy tool by @Adam Bowen for examle this file https://github.com/delphix/delphixpy-examples/blob/da86c4c0b581e8efa5dee928e0edc451d78d449b/via_httplib.py

    Also please feel free to take a look on the great dxtool by @Marcin Przepiorowski perl base coded it can give you some inspiration.


    Hope this clarifies things for you

    BR,

    Mouhssine​​​​

    ------------------------------
    Mouhssine SAIDI
    Community Member
    Delphix Community Members
    ------------------------------



  • 6.  RE: Engine Upgrade

    Posted 07-28-2020 03:00:00 AM
    Edited by Mouhssine Saidi 08-03-2020 07:37:26 AM
    Hi Dafna,

    If this answer helped you in any maner, or need further assisstance ?

    Regards,

    Mouhssine

    ------------------------------
    Mouhssine SAIDI
    Community Member
    Delphix Community Members
    ------------------------------