Closed rkawecki-eq closed 11 months ago
What exact version are you running? I'm testing this on 6.8.1_u6_release-20231115_72da2790 and it is working fine.
It would seem like the support-toolbox installation is incomplete. You can try typing this command:
export PYTHONPATH=/usr/lib/python2.7/site-packages:$PYTHONPATH
then try running the script again
Hi Brian,
We are on 6.8.1_u5_release-20230907_89061e30
Hi,
Done. I think I'm getting the same error(s)
@. ~]$ export PYTHONPATH=/usr/lib/python2.7/site-packages:$PYTHONPATH
@. ~]$ ./extendRetention.py -s cohesity01b-wat.equitable.int -u svc_cohesity_scripts -d equitable.int -j '_PRODDWMY16' -wr 35 -w 6 -mr 84 -m 1 -yr 84 -y 1
Traceback (most recent call last):
File "./extendRetention.py", line 9, in
Sorry. Similar errors, more of them, and different lines
OK try this to start a python virtual environment:
python3 -m venv myenv
source myenv/bin/activate
pip3 install requests
then run your script. When done, type this to exit the python virtual environment:
deactivate
Yup. That worked
Running bash from SSH_CONNECTION: 10.10.0.165 52527 10.10.0.175 22 Commands are being logged. Precede log comments with '#'. @. ~]$ ls extendRetention.py pyhesity.py pyhesity.pyc smtptool.py @. ~]$ python3 -m venv myenv @. ~]$ source myenv/bin/activate (myenv) @. ~]$ pip3 install requests Requirement already satisfied: requests in /home/cohesity/6.8.1_u5_release-20230907_89061e30/crux/bin/support-toolbox/libraries/dcr/libraries Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in /home/cohesity/6.8.1_u5_release-20230907_89061e30/crux/bin/support-toolbox/libraries/dcr/libraries (from requests) Requirement already satisfied: certifi>=2017.4.17 in /home/cohesity/6.8.1_u5_release-20230907_89061e30/crux/bin/support-toolbox/libraries/dcr/libraries (from requests) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/cohesity/6.8.1_u5_release-20230907_89061e30/crux/bin/support-toolbox/libraries/dcr/libraries (from requests) Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /home/cohesity/6.8.1_u5_release-20230907_89061e30/crux/bin/support-toolbox/libraries/dcr/libraries (from requests) You are using pip version 9.0.3, however version 23.3.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (myenv) @. ~]$ ./extendRetention.py -s cohesity01b-wat.equitable.int -u svc_cohesity_scripts -d equitable.int -j '_PRODDWMY16' -wr 35 -w 6 -mr 84 -m 1 -yr 84 -y 1 Connected! Job: 10PM_PROD_DWMY16_VM_BAR 2023-12-17 22:00:01 extending retention to 2024-01-21 22:00:01 2023-12-10 22:00:00 extending retention to 2024-01-14 22:00:00 Job: 9PM_PROD_DWMY16_VM_CONFIG_BAR 2023-12-17 21:00:00 extending retention to 2024-01-21 21:00:00 2023-12-10 21:00:01 extending retention to 2024-01-14 21:00:01 Job: 1130PM_GRPPRDSQLP01_PROD_DWMY16_AGENT_BAR 2023-12-17 23:30:01 extending retention to 2024-01-21 23:30:01 2023-12-10 23:30:01 extending retention to 2024-01-14 23:30:01 Job: 7PM_EQWATIFSFSP08_PROD_DWMY16_VM_BAR 2023-12-17 19:00:00 extending retention to 2024-01-21 19:00:00 2023-12-10 19:00:01 extending retention to 2024-01-14 19:00:01 Job: 7PM_EQWATIFSFSP10_PROD_DWMY16_VM_BAR 2023-12-17 19:00:00 extending retention to 2024-01-21 19:00:00 2023-12-10 19:00:01 extending retention to 2024-01-14 19:00:01 Job: 7PM_IFSFSP03_PROD_DWMY16_VM_WAT 2023-12-17 19:00:04 extending retention to 2024-01-21 19:00:04 Job: 7PM_EQWATIFSFSP06_IFSFSP04_PROD_DWMY16_VM_BAR 2023-12-17 19:00:00 extending retention to 2024-01-21 19:00:00 2023-12-10 19:00:01 extending retention to 2024-01-14 19:00:01 Job: 9PM_PROD_DWMY16_VM_BAR 2023-12-17 21:00:00 extending retention to 2024-01-21 21:00:00 2023-12-10 21:00:01 extending retention to 2024-01-14 21:00:01 (myenv) @. ~]$ deactivate -bash: $1: unbound variable @.*** ~]$
OK so that tells me that there's something wrong with the support-toolbox install. I'm going to report that back to the support case. In the meantime, you can use those steps as a workaround.
For anyone else reading this issue, the issue is the python module dependencies, which is a common problem with python scripts. We found several solutions: 1) Use a virtual environment (as mentioned above), 2) run the script on another machine where python is setup as needed, or 3) compile the script into a stand alone executable that has all the dependencies baked in. That's what we did here. I published compiled versions of the extendRetention script, for linux: https://github.com/bseltz-cohesity/scripts/tree/master/linux/extendRetention and for windows: https://github.com/bseltz-cohesity/scripts/tree/master/windows/extendRetention
Any idea?
C:\Temp>extendRetention -s cohesity01b-wat.equitable.iont -u svc_cohesity_scripts -d equitable.int -j '_PRODDWMY3' -wr 35 -w 6 -mr 84 -m 1 -yr 84 -y 1
HTTPSConnectionPool(host='cohesity01b-wat.equitable.iont', port=443): Max retries exceeded with url: /login (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x000001957523D430>: Failed to resolve 'cohesity01b-wat.equitable.iont' ([Errno 11001] getaddrinfo failed)"))
Not Connected
Traceback (most recent call last):
File "extendRetention.py", line 73, in
Ignore. Had a typo
Hi,
Is there a parameter for putting in the username password?
username parameter is -u
or --username
there is no password parameter. The script will prompt for the password and store it for future use. If needed I can add a password parameter.
When suing the EXE how does the password get stored? Does the storage of the password persist Windows reboots?
Can't seem to run the Script in Cohesity OS 6.8.
Here are the errors
[support@cohesity]$ ./extendRetention.py -s cohesity.company.com -u svc_cohesity_scripts -d equitable.int -j '_PRODDWMY3' -wr 35 -w 6 -mr 84 -m 1 -yr 84 -y 1 Traceback (most recent call last): File "./extendRetention.py", line 9, in
from pyhesity import *
File "/cohesity_users_home/support/pyhesity.py", line 36, in
import requests
File "/home/cohesity/bin/support-toolbox/libraries/dcr/libraries/requests/init.py", line 48, in
from charset_normalizer import version as charset_normalizer_version
File "/home/cohesity/bin/support-toolbox/libraries/dcr/libraries/charset_normalizer/init.py", line 24, in
from .api import from_bytes, from_fp, from_path, normalize
File "/home/cohesity/bin/support-toolbox/libraries/dcr/libraries/charset_normalizer/api.py", line 43
sequences: bytes,
^
SyntaxError: invalid syntax