image_pdfimage_print

Pure Storage has an automation Python toolkit that helps get you started managing the FlashArray so you don’t have to deal with the direct REST work in your Python scripts. You can find information about that here:

https://pythonhosted.org/purestorage/index.html

 

I am just using the standard Windows Python install. I’m probably more of a fan of his methods, but this method is a bit simpler if you just want to get your feet wet quickly. So first, install the latest version of Python for Windows, you can get that here.

Pretty simple install. Then open a Windows command prompt.

We need to install the Pure Storage module, which is pretty easy as PIP is built into this version of Python. So cd into C:Python27Scripts or where ever you installed Python and run the following:

You should see it successfully install, only takes a few seconds.

isntallpurepython

To verify the module and version you can run:

versions

The nice thing about this, is that you do not need to directly download anything, it will grab it off the net automatically.

Now launch the Python CLI tool.

pythoncli

Import the purestorage module with the following command:

Now you can run Pure Storage commands! Instantiate an array like so:

If you see an error like below, you need to fix your certificate problems, or you can have it ignore cert errors.certwarning

So you need to import requests and then disable these warnings so you don’t see them anymore:

nocertwarning

Try the array connect command again and it will create an array object and connect to the FlashArray to create an authenticated session. Now you can run commands, like creating a volume etc:

Done!

newvol

Stay tuned for more.