Difference between revisions of "Redfish:Accessing Redfish enabled systems using Python"
Jump to navigation
Jump to search
| Line 4: | Line 4: | ||
* As of this writing, only Red Hat 6.x is supported (tested) | * As of this writing, only Red Hat 6.x is supported (tested) | ||
* This document only covers additional steps needed to make redfish run on the OS. It does not cover OS installation instructions. | * This document only covers additional steps needed to make redfish run on the OS. It does not cover OS installation instructions. | ||
| + | * This was done on a vanilla CentOS 6.7 installation | ||
== Installation of Chrome Browser == | == Installation of Chrome Browser == | ||
| Line 31: | Line 32: | ||
* '''This should be done as root''' | * '''This should be done as root''' | ||
<syntaxhighlight> | <syntaxhighlight> | ||
| − | [root@localhost Downloads]# yum groupinstall "development tools" -y | + | [root@localhost Downloads]# yum -y groupinstall "development tools" |
| + | [root@localhost Downloads]# yum -y install zlib-devel openssl openssl-devel | ||
[root@localhost Downloads]# mkdir tmp | [root@localhost Downloads]# mkdir tmp | ||
[root@localhost Downloads]# cd tmp | [root@localhost Downloads]# cd tmp | ||
| Line 70: | Line 72: | ||
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/jon/bin:/opt/python2.7/bin | /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/jon/bin:/opt/python2.7/bin | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | == Install PIP 2.7 == | ||
| + | * '''Installation must be done as root''' | ||
| + | <syntaxhighlight> | ||
| + | [root@localhost ~]# cd /opt/python2.7/bin/ | ||
| + | [root@localhost bin]# wget https://bootstrap.pypa.io/get-pip.py | ||
| + | [root@localhost bin]# ./python2.7 get-pip.py | ||
| + | Collecting pip | ||
| + | /tmp/tmpWViYfj/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. | ||
| + | Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) | ||
| + | 100% |████████████████████████████████| 1.1MB 306kB/s | ||
| + | Collecting setuptools | ||
| + | Downloading setuptools-19.2-py2.py3-none-any.whl (463kB) | ||
| + | 100% |████████████████████████████████| 466kB 719kB/s | ||
| + | Collecting wheel | ||
| + | Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB) | ||
| + | 100% |████████████████████████████████| 65kB 4.5MB/s | ||
| + | Installing collected packages: pip, setuptools, wheel | ||
| + | Successfully installed pip-7.1.2 setuptools-19.2 wheel-0.26.0 | ||
| + | /tmp/tmpWViYfj/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. | ||
| + | </syntaxhighlight> | ||
| + | * '''NB:''' If <code>wget</code> command does not work, use <code>wget --no-check-certificate</code> command | ||
Revision as of 12:36, 11 January 2016
Introduction
- This documents contains preparation on the OS to make redfish runs from the OS command line console.
- One sample python script is provided, with sample output.
- As of this writing, only Red Hat 6.x is supported (tested)
- This document only covers additional steps needed to make redfish run on the OS. It does not cover OS installation instructions.
- This was done on a vanilla CentOS 6.7 installation
Installation of Chrome Browser
- Not actually vital but useful for when you have to do individual manual test, launching RESTful API commands, etc
- Installation must be done as root
[root@localhost ~]# cd Downloads/
[root@localhost Downloads]# wget http://chrome.richardlloyd.org.uk/install_chrome.sh
--2016-01-11 03:50:00-- http://chrome.richardlloyd.org.uk/install_chrome.sh
Resolving chrome.richardlloyd.org.uk... 193.110.246.53
Connecting to chrome.richardlloyd.org.uk|193.110.246.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 79768 (78K) [application/x-sh]
Saving to: “install_chrome.sh”
100%[================================================================================>] 79,768 --.-K/s in 0.1s
2016-01-11 03:50:01 (541 KB/s) - “install_chrome.sh” saved [79768/79768]
[root@localhost Downloads]# chmod +x install_chrome.sh
[root@localhost Downloads]# ./install_chrome.shInstallation of Python 2.7
- Next, you will need to install Python 2.7, since Red Hat default Python version is 2.6
- Warning: Red Hat OS depends on Python version 2.6, therefore, Python version 2.7 must coexist, and you are not allowed to replace version 2.6
- This should be done as root
[root@localhost Downloads]# yum -y groupinstall "development tools"
[root@localhost Downloads]# yum -y install zlib-devel openssl openssl-devel
[root@localhost Downloads]# mkdir tmp
[root@localhost Downloads]# cd tmp
[root@localhost tmp]# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz
[root@localhost tmp]# tar zxvf Python-2.7.3.tgz
[root@localhost tmp]# cd Python-2.7.3
[root@localhost Python-2.7.3]# ./configure --prefix=/opt/python2.7 --enable-shared
[root@localhost Python-2.7.3]# make
[root@localhost Python-2.7.3]# make altinstall
[root@localhost Python-2.7.3]# echo "/opt/python2.7/lib" >> /etc/ld.so.conf.d/opt-python2.7.conf
[root@localhost Python-2.7.3]# ldconfigSetup Path
- Go to your home directory, then edit your .bashrc file
- Note: You don’t have to be root to edit .bashrc, since this is your own account’s file
- Add this line to your .bashrc file:
export PATH=${PATH}:/opt/python2.7/bin
- For example:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export PATH=${PATH}:/opt/python2.7/bin- Then source
.bashrc
[jon@localhost ~]$ source ./.bashrc- Confirm the Python 2.7 binary directory is now in your path:
[jon@localhost ~]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/jon/bin:/opt/python2.7/binInstall PIP 2.7
- Installation must be done as root
[root@localhost ~]# cd /opt/python2.7/bin/
[root@localhost bin]# wget https://bootstrap.pypa.io/get-pip.py
[root@localhost bin]# ./python2.7 get-pip.py
Collecting pip
/tmp/tmpWViYfj/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB)
100% |████████████████████████████████| 1.1MB 306kB/s
Collecting setuptools
Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 719kB/s
Collecting wheel
Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB)
100% |████████████████████████████████| 65kB 4.5MB/s
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-7.1.2 setuptools-19.2 wheel-0.26.0
/tmp/tmpWViYfj/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.- NB: If
wgetcommand does not work, usewget --no-check-certificatecommand