Pure Storage Python Toolkit with BASH on Windows 10

Microsoft recently announced the new Windows 10 Insider Preview Build 14316 which includes the ability to run native bash on Ubuntu on Windows. First off BRILLIANT! Secondly I just had to get this working with the new Pure Storage Python Toolkit 1.6. Here is the short journey to get things working. The example script does the following:

  1. Connects to the Pure Storage FlashArray
  2. Creates a new volume
  3. Creates a snapshot of the new volume
  4. Creates a new volume from the new snapshot
  5. Create a Protection Group
  6. Adds the new volume from the snapshot to the Protection Group
  7. Creates a Protection Group snapshot
  8. Performs a cleanup of items 1 – 7


  1. Follow the steps in the following MSDN article, https://blogs.msdn.microsoft.com/commandline/2016/04/06/bash-on-ubuntu-on-windows-download-now-3/ to download and install the Windows 10 Insider Preview Build 14316 and get the Windows Subsystem for Linux (Beta) running.
  2. Once the Windows Subsystem for Linux is running open a Command Prompt (Admin) and type bash.bash_prompt
  3. Run all of the following commands:

    wget https://pypi.python.org/packages/source/p/purestorage/purestorage-1.6.0.tar.gz
    apt-get update
    apt-get install python-pip
    pip install requests 
    pip install purestorage-1.6.0.tar.gz
  4. Basic Python script creation:
    vim PS-BASHTEST.py
    from purestorage import purestorage
    array = purestorage.FlashArray(target="”, username="pureuser",password="xxxxxxx")
    print "Creating volume..."
    array.create_volume("BASH-VOL1", size="1T")
    print "Creating snapshot..."
    array.create_snapshots(['BASH-VOL1'], suffix="FOO")
    print "Creating new volume from snapshot..."
    array.copy_volume(source="BASH-VOL1.FOO", dest="BASH-TEST")
    print "Creating Protection Group and adding Volume..."
    print "Creating Protection Group snapshot..."
    print "CLEANUP-----------------------------------------------------"
    response = raw_input("Do you want to remove everything? y/n ")
    if response == "y":
     print("\n All objects destroyed and eradicated.")
     print("\n Nothing destroyed.")
  5. Save and Exit
    ESC :x
  6. Run the script:
    python PS-BASHTEST.py

Best new feature in Windows I’ve seen in years!


One comment

Add Comment

Required fields are marked *. Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.