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 Swift Python Script
The following instructions are an alternative to installing Git Bash.
Install Python Swift Client
Download Python version 3.6 or higher (download python)
In the Python Installation Setup, check
Add Python to PATH
, then click Install Now.Verify that the Path was successfully added as an Environmental Variable.
Click on your Windows Start button or search bar, and type
Edit Environment
.Click the presented option, should match the image below, to open the System Properties window.
Under User variables for <username>, one should find a variable
PATH
orPYTHONPATH
with the following values:C:\YourPythonFolder
, whereC:\YourPythonFolder
is the location where you installed PythonC:\YourPythonFolder\Scripts
If this is not the case, please add the variable
PYTHONPATH
with the values described above.
Open Command Prompt, by clicking on the Windows Start Button, typing
Command Prompt
, and clicking it.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:
Download the following Visual Studio C++ Tools. It will first prompt you to download the Visual Studio Installer.
In the pop-up window, scroll down to Desktop & Mobile and select C++ build tools.
Click Install.
Reopen the command prompt and try installing it again.
Set up Your Environment
Login to https://dashboard.cloud.sdsc.edu
Select the project you want to access (See: How to Change Current Working Project)
Download the OpenStack RC File (See: How To Download the OpenStack Project RC File)
Open your RC file in a text editor like Notepad.
Remove all lines that do not begin with
export
.
You should have something similar to this:Locate the following line:
export OS_PASSWORD=$OS_PASSWORD_INPUT
. Delete this line.Replace all instances of
export
withsetx
.Replace all equal signs,
=
, with a space.Place quotation marks around all variable values.
Your file should now look similar to this:Note: Parts of the image are censored.
Click on the File Tab and click Save As.
Change Save as Type to All Files. Save the file into your working directory with the extension .bat
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.
Type
exit
in the Command Prompt to terminate the active terminal session. Then open a new Command Prompt window.In the terminal, run the following command to set the environmental variables.
set|findstr OS_
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 usedcd downloads
.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.