Oct-20-2018, 08:58 PM
(This post was last modified: Oct-20-2018, 09:03 PM by alinaveed786.)
Nope. Still, unzip is not working. I have listed the directory in the code before and after the unzip
Moreover, after unzipping the directory name to be 21171382 and 21463894 without prefix 'p', hence I gave "local.cwd.chdir('/u03/{}'.format(i))"
Moreover, after unzipping the directory name to be 21171382 and 21463894 without prefix 'p', hence I gave "local.cwd.chdir('/u03/{}'.format(i))"
#!/usr/local/bin/python3.6 import subprocess from plumbum import local, cmd patch = [21171382,21463894] ORACLE_HOME = local.env['ORACLE_HOME'] path = local.env['PATH'] local.env['PATH'] = "{ohome}/bin:{ohome}/OPatch:{path}".format(ohome=ORACLE_HOME, path=local.env['PATH']) osTyp = cmd.uname('-s').strip() local.cwd.chdir('/u03/') subprocess.run('ls -ltr', shell=True) for i in patch: if osTyp == 'Linux': print(cmd.unzip('-o','-v',"/u03/p{}_*.zip".format(i))) subprocess.run('ls -ltr', shell=True) local.cwd.chdir('/u03/{}'.format(i)) print('Patch applied') elif osTyp == 'SunOs': cmd.unzip("p{}_121020_Solaris-x86-64.zip".format(i)) else: print("!!\n!! unable to determine OS type !!\n!!")Error:
total 97380 drwxr-xr-x. 3 oracle oinstall 4096 Jun 19 2017 app -rwxrwx---. 1 oracle oinstall 99183505 Oct 17 20:57 p6880880_121010_Linux-x86-64.zip -rwxrwx---. 1 oracle oinstall 451814 Oct 17 21:01 p21171382_12102180417_Generic.zip -rwxrwx---. 1 oracle oinstall 73502 Oct 17 21:10 p21463894_121020_Linux-x86-64.zip Archive: /u03/p21171382_12102180417_Generic.zip Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/sqlpatch/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/sqlpatch/21171382/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/sqlpatch/21171382/22292308/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/sqlpatch/21171382/22292308/rollback_files/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/sqlpatch/21171382/22292308/rollback_files/rdbms/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/sqlpatch/21171382/22292308/rollback_files/rdbms/admin/ 290535 Defl:N 220895 24% 06-27-2018 10:48 29b949e5 21171382/files/sqlpatch/21171382/22292308/rollback_files/rdbms/admin/prvtstat.plb 935 Defl:N 474 49% 06-27-2018 10:48 9793a371 21171382/files/sqlpatch/21171382/22292308/rollback_files/rdbms/admin/execstat.sql 627 Defl:N 335 47% 06-27-2018 10:48 162e19b2 21171382/files/sqlpatch/21171382/22292308/21171382.xml 1980 Defl:N 682 66% 06-27-2018 10:48 508c13d9 21171382/files/sqlpatch/21171382/22292308/21171382_rollback.sql 1968 Defl:N 675 66% 06-27-2018 10:48 c21d3bbe 21171382/files/sqlpatch/21171382/22292308/21171382_apply.sql 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/rdbms/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/files/rdbms/admin/ 291062 Defl:N 221314 24% 06-27-2018 10:48 b75a453e 21171382/files/rdbms/admin/prvtstat.plb 2714 Defl:N 718 74% 06-27-2018 10:48 17defd59 21171382/files/rdbms/admin/execstat.sql 6089 Defl:N 2212 64% 10-01-2018 03:42 f86d4ac8 21171382/README.txt 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/etc/ 0 Defl:N 2 0% 06-27-2018 10:48 00000000 21171382/etc/config/ 1535 Defl:N 656 57% 06-27-2018 10:48 4360dd6c 21171382/etc/config/inventory.xml 1242 Defl:N 297 76% 06-27-2018 10:48 c0f3cde0 21171382/etc/config/actions.xml -------- ------- --- ------- 598687 448282 25% 22 files total 97380 drwxr-xr-x. 3 oracle oinstall 4096 Jun 19 2017 app -rwxrwx---. 1 oracle oinstall 99183505 Oct 17 20:57 p6880880_121010_Linux-x86-64.zip -rwxrwx---. 1 oracle oinstall 451814 Oct 17 21:01 p21171382_12102180417_Generic.zip -rwxrwx---. 1 oracle oinstall 73502 Oct 17 21:10 p21463894_121020_Linux-x86-64.zip Traceback (most recent call last): File "/u02/scripts/Patching/Test.py", line 21, in <module> local.cwd.chdir('/u03/{}*'.format(i)) File "/usr/local/lib/python3.6/site-packages/plumbum/path/local.py", line 354, in chdir os.chdir(str(newdir)) FileNotFoundError: [Errno 2] No such file or directory: '/u03/21171382*' Process finished with exit code 1