Skip to content

Commit 01ad6ed

Browse files
authored
Merge branch 'master' into hurrynair/implement-client-role-10
2 parents 1866ffd + 25ca49f commit 01ad6ed

File tree

12 files changed

+567
-188
lines changed

12 files changed

+567
-188
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"python.pythonPath": "/bin/python3",
2626
"python.envFile": "${workspaceFolder}/gitpod.env",
2727
"editor.formatOnSave": true,
28-
"files.insertFinalNewline": true
28+
"files.insertFinalNewline": true,
29+
"git.alwaysSignOff": true
2930
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ See:
3131

3232
## Installation
3333

34+
To install on HPE CP Centos/Redhat 7.7 hosts, see [here](./docs/README-INSTALL-HPECP-HOSTS.md)
35+
3436
```shell
3537
# ensure you have an up-to-date pip
3638
pip3 install -U pip

bin/cli.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,23 @@ def post(
867867
)
868868
print(response.text)
869869

870+
def put(
871+
self, url, json_file="",
872+
):
873+
"""Make HTTP PUT request
874+
875+
Example:
876+
877+
hpecp httpclient put /api/v2/config/auth --json-file my.json
878+
"""
879+
with open(json_file, "r",) as f:
880+
data = json.load(f)
881+
882+
response = get_client()._request(
883+
url, http_method="put", data=data, description="CLI HTTP PUT",
884+
)
885+
print(response.text)
886+
870887

871888
class UserProxy:
872889
def create(
@@ -1040,7 +1057,7 @@ def configure_cli():
10401057
controller_password = config_reader.password
10411058

10421059
sys.stdout.write("Controller API Host [{}]: ".format(controller_api_host))
1043-
tmp = input()
1060+
tmp = raw_input()
10441061
if tmp != "":
10451062
controller_api_host = tmp
10461063

@@ -1073,12 +1090,12 @@ def configure_cli():
10731090
controller_warn_ssl = tmp
10741091

10751092
sys.stdout.write("Controller Username [{}]: ".format(controller_username))
1076-
tmp = input()
1093+
tmp = raw_input()
10771094
if tmp != "":
10781095
controller_username = tmp
10791096

10801097
sys.stdout.write("Controller Password [{}]: ".format(controller_password))
1081-
tmp = input()
1098+
tmp = raw_input()
10821099
if tmp != "":
10831100
controller_password = tmp
10841101

docs/README-INSTALL-HPECP-HOSTS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Installing the CLI on HPE Container Platform Centos/Redhat Hosts
2+
---
3+
4+
There is an [issue](https://github.com/hpe-container-platform-community/hpecp-python-library/issues/45)
5+
with the version of Python installed by default on HPE CP.
6+
7+
For demo environments, you can workaround this using pyenv:
8+
9+
```
10+
sudo yum install -y gcc gcc-c++ make git patch openssl-devel zlib zlib-devel readline-devel sqlite-devel bzip2-devel libffi-devel
11+
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
12+
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
13+
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
14+
source ~/.bashrc
15+
pyenv install 3.6.10
16+
17+
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
18+
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
19+
source ~/.bashrc
20+
21+
pyenv virtualenv 3.6.10 my-3.6.10
22+
pyenv activate my-3.6.10
23+
24+
pip install --upgrade pip
25+
pip install --upgrade git+https://github.com/hpe-container-platform-community/hpecp-client@master
26+
```
27+
28+
Whenever you run the hpecp cli activate python 3.6.10 first, I.e.
29+
30+
```
31+
pyenv activate my-3.6.10
32+
hpecp do_something
33+
```

0 commit comments

Comments
 (0)