Swift Python Script: Windows Users

For Windows Users, it is recommended to install Git for Windows and use Git Bash to source the environment variables and run all CLI commands.
With Git Bash, follow Steps 1-3 of Install Python Swift Client below. Then follow the instructions on https://sdsc-ucsd.atlassian.net/wiki/spaces/SC/pages/110034985

The following instructions are an alternative to installing Git Bash.

Install Python Swift Client

  1. Download Python version 3.6 or higher (download python)

  2. In the Python Installation Setup, check Add Python to PATH, then click Install Now.

  3. Verify that the Path was successfully added as an Environmental Variable.

    1. Click on your Windows Start button or search bar, and type Edit Environment.

    2. Click the presented option, should match the image below, to open the System Properties window.

    3. Under User variables for <username>, one should find a variable PATH or PYTHONPATH with the following values:

      1. C:\YourPythonFolder, where C:\YourPythonFolder is the location where you installed Python

      2. C:\YourPythonFolder\Scripts

    4. If this is not the case, please add the variable PYTHONPATH with the values described above.

  4. Open Command Prompt, by clicking on the Windows Start Button, typing Command Prompt, and clicking it.

  5. Install python-swiftclient using pip:

    py -m pip install python-keystoneclient py -m pip install python-swiftclient

Note: When installing, you may see the following error:

error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

To fix this:

  1. Download the following Visual Studio C++ Tools. It will first prompt you to download the Visual Studio Installer.

  2. In the pop-up window, scroll down to Desktop & Mobile and select C++ build tools.

  3. Click Install.

  4. Reopen the command prompt and try installing it again.

Set up Your Environment

  1. Login to https://dashboard.cloud.sdsc.edu

  2. Select the project you want to access (See: https://sdsc-ucsd.atlassian.net/wiki/spaces/SC/pages/110034978)

  3. Download the OpenStack RC File (See: https://sdsc-ucsd.atlassian.net/wiki/spaces/SC/pages/110034947)

  4. Open your RC file in a text editor like Notepad.

  5. Remove all lines that do not begin with export.
    You should have something similar to this:

  6. Locate the following line: export OS_PASSWORD=$OS_PASSWORD_INPUT. Delete this line.

  7. Replace all instances of export with setx.

  8. Replace all equal signs, =, with a space.

  9. Place quotation marks around all variable values.
    Your file should now look similar to this:

    Note: Parts of the image are censored.

  10. Click on the File Tab and click Save As.

  11. Change Save as Type to All Files. Save the file into your working directory with the extension .bat

  12. Locate the saved bat file, right-click and select the Run As Administrator option. This will add your variables as environmental variables, but not in your current Command Prompt session yet.

  13. Type exit in the Command Prompt to terminate the active terminal session. Then open a new Command Prompt window.

  14. In the terminal, run the following command to set the environmental variables.

    set|findstr OS_
  15. To manually check that the variable properties were set correctly, navigate to the directory of the bat file.

    Replace directorypath with the bat file directory. In this example, we used cd downloads.

  16. Type the file name and click Enter. You should see the following output:

This completes this setup and enables the use of swift commands in the Command Prompt for Windows users. Please refer to this page for Command Line Examples.
Note: The password was not saved as an environmental variable for security reasons. So in addition to using the swift commands, you’ll need to add --os-password password123 at the end of every command. password123 would be replaced with your OpenStack Project password.

Some examples:

To switch RC File projects, one would need to delete and remove all OS variables from the User Environmental Variables list and repeat the instructions above for the desired openrc.sh file.