| Line 1... |
Line 1... |
| 1 |
'=====================================================
|
1 |
'=====================================================
|
| 2 |
' Name: pkg_archive
|
2 |
' Name: pkg_archive
|
| 3 |
' Description: This library contains methods required
|
3 |
' Description: This library contains methods required
|
| 4 |
' for dpkg_archive and deploy_archive
|
4 |
' for dpkg_archive manipulation.
|
| 5 |
' manipulation.
|
- |
|
| 6 |
'=====================================================
|
5 |
'=====================================================
|
| 7 |
|
6 |
|
| 8 |
Option Explicit
|
7 |
Option Explicit
|
| 9 |
|
8 |
|
| 10 |
Class PkgArchive
|
9 |
Class PkgArchive
|
| Line 38... |
Line 37... |
| 38 |
Function UnixPath( SSpath )
|
37 |
Function UnixPath( SSpath )
|
| 39 |
If SSpath <> "" Then UnixPath = Replace( SSpath, "\", "/" )
|
38 |
If SSpath <> "" Then UnixPath = Replace( SSpath, "\", "/" )
|
| 40 |
End Function
|
39 |
End Function
|
| 41 |
'-----------------------------------------------------------------------------------------------------------------
|
40 |
'-----------------------------------------------------------------------------------------------------------------
|
| 42 |
Sub Ensure_Read_Write ( SSpkg_name, SSpkg_version )
|
41 |
Sub Ensure_Read_Write ( SSpkg_name, SSpkg_version )
|
| 43 |
Dim outMachine, outUser, outPassword
|
42 |
Dim outMachine, outUser, outPassword, rv
|
| 44 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
43 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
| 45 |
WScript.Echo "Allowing Read and Write on folder "& SSpkg_version
|
44 |
WScript.Echo "Allowing Read and Write on folder "& SSpkg_name & "/" & SSpkg_version
|
| 46 |
|
45 |
|
| 47 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
46 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
| 48 |
|
47 |
|
| 49 |
' Set all folders to +RWX and all files to +RW
|
- |
|
| 50 |
' --- Commands to run ---
|
48 |
' Make the package writable
|
| 51 |
'command = _
|
- |
|
| 52 |
'"cd "& pArchive_Path &" && "&_
|
- |
|
| 53 |
'"chmod a+rwx "& SSpkg_name &"; "&_
|
- |
|
| 54 |
'"cd "& SSpkg_name &" && "&_
|
- |
|
| 55 |
'"find '"& SSpkg_version &"' -type d -exec chmod a+rwx {} \; ; "&_
|
49 |
' Invoke script on package server to perform the hard work
|
| 56 |
'"chmod -R a+rw "& SSpkg_version &"; "
|
50 |
' It must be done under UNIX as it can't be done under windows
|
| 57 |
|
51 |
'
|
| 58 |
command = _
|
52 |
command = _
|
| 59 |
"sudo ~/sbin/make_writable "& pArchive_Path &" '"& SSpkg_name &"' '"& SSpkg_version &"';"
|
53 |
"sudo ~/sbin/make_writable "& pArchive_Path &" '"& SSpkg_name &"' '"& SSpkg_version &"';"
|
| 60 |
|
54 |
|
| 61 |
WScript.Echo command
|
55 |
WScript.Echo command
|
| 62 |
|
56 |
|
| 63 |
' --- SSH client with login details ---
|
57 |
' --- SSH client with login details ---
|
| 64 |
'login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
58 |
login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
| 65 |
login_details = AppPath & WINRSH_EXE &" -q -h "& pRemote_Host &" -l "& outUser &" -p "& outPassword
|
- |
|
| 66 |
|
59 |
|
| 67 |
'WScript.Echo login_details &" """& command &""""
|
60 |
'WScript.Echo login_details &" """& command &""""
|
| 68 |
|
61 |
|
| 69 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
62 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
| 70 |
sysShell.Run "cmd.exe /c "& login_details &" """& command &"""", 0, True
|
63 |
rv = sysShell.Run ("cmd.exe /c "& login_details &" """& command &"""", 0, True)
|
| 71 |
|
- |
|
| 72 |
|
- |
|
| 73 |
|
- |
|
| 74 |
'Set oExec = sysShell.Exec( login_details &" "& command )
|
- |
|
| 75 |
'Set oExec = sysShell.Exec( login_details &" """& command &"""" )
|
- |
|
| 76 |
|
- |
|
| 77 |
'outStrOut = oExec.StdOut.ReadAll
|
- |
|
| 78 |
'outStrErr = oExec.StdErr.ReadAll
|
- |
|
| 79 |
|
- |
|
| 80 |
'If outStrErr <> "" Then
|
- |
|
| 81 |
' Call Raise_Event ( enumEVENT_ERROR, "[sub:Ensure_Read_Write]", _
|
- |
|
| 82 |
' "user: "& outUser & VBNewLine &_
|
- |
|
| 83 |
' "command: "& command , _
|
- |
|
| 84 |
' outStrErr, enum_RELEASE_NOTES_FAILED )
|
- |
|
| 85 |
'End If
|
- |
|
| 86 |
'Set oExec = Nothing
|
- |
|
| 87 |
Set sysShell = Nothing
|
64 |
Set sysShell = Nothing
|
| - |
|
65 |
|
| - |
|
66 |
If ( rv <> 0 ) then
|
| - |
|
67 |
Call Raise_Event ( enumEVENT_ERROR, "Ensure_Read_Write", "Command Failure: " & rv, "Command :" & login_details &" """& command &"""",enum_RELEASE_NOTES_FAILED )
|
| - |
|
68 |
End If
|
| - |
|
69 |
|
| 88 |
|
70 |
|
| 89 |
End Sub
|
71 |
End Sub
|
| 90 |
'-----------------------------------------------------------------------------------------------------------------
|
72 |
'-----------------------------------------------------------------------------------------------------------------
|
| 91 |
Sub All_Read_Only ( SSpkg_name, SSpkg_version )
|
73 |
Sub All_Read_Only ( SSpkg_name, SSpkg_version )
|
| 92 |
Dim outMachine, outUser, outPassword
|
74 |
Dim outMachine, outUser, outPassword, rv
|
| 93 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
75 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
| 94 |
|
76 |
|
| 95 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
77 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
| 96 |
|
78 |
|
| 97 |
' Set all folders from version folder, to -W and all files to -W
|
- |
|
| 98 |
' --- Commands to run ---
|
79 |
' Make package ReadOnly
|
| 99 |
'command = _
|
- |
|
| 100 |
'"cd "& pArchive_Path &"/"& SSpkg_name &" && "&_
|
- |
|
| 101 |
'"find '"& SSpkg_version &"' -type d -exec chmod a-w {} \; ; "&_
|
- |
|
| 102 |
'"chmod -R a-w "& SSpkg_version &"; "&_
|
- |
|
| 103 |
'"chown -R root:other "& SSpkg_version &"; "
|
- |
|
| 104 |
|
80 |
|
| 105 |
command = _
|
81 |
command = _
|
| 106 |
"sudo ~/sbin/make_readonly "& pArchive_Path &" '"& SSpkg_name &"' '"& SSpkg_version &"';"
|
82 |
"sudo ~/sbin/make_readonly "& pArchive_Path &" '"& SSpkg_name &"' '"& SSpkg_version &"';"
|
| 107 |
|
83 |
|
| 108 |
WScript.Echo command
|
84 |
WScript.Echo command
|
| 109 |
|
85 |
|
| 110 |
' --- SSH client with login details ---
|
86 |
' --- SSH client with login details ---
|
| 111 |
'login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
87 |
login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
| - |
|
88 |
|
| 112 |
login_details = AppPath & WINRSH_EXE &" -q -h "& pRemote_Host &" -l "& outUser &" -p "& outPassword
|
89 |
'WScript.Echo login_details &" """& command &""""
|
| 113 |
|
- |
|
| 114 |
|
- |
|
| 115 |
|
- |
|
| 116 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
90 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
| 117 |
sysShell.Run "cmd.exe /c "& login_details &" """& command &"""", 0, True
|
91 |
rv = sysShell.Run ("cmd.exe /c "& login_details &" """& command &"""", 0, True)
|
| 118 |
|
- |
|
| 119 |
'Set oExec = sysShell.Exec( login_details &" "& command )
|
- |
|
| 120 |
|
- |
|
| 121 |
'outStrOut = oExec.StdOut.ReadAll
|
- |
|
| 122 |
'outStrErr = oExec.StdErr.ReadAll
|
- |
|
| 123 |
|
- |
|
| 124 |
'If outStrErr <> "" Then
|
- |
|
| 125 |
' Call Raise_Event ( enumEVENT_ERROR, "[sub:All_Read_Only]", _
|
- |
|
| 126 |
' "user: "& outUser & VBNewLine &_
|
- |
|
| 127 |
' "command: "& command , _
|
- |
|
| 128 |
' outStrErr, enum_RELEASE_NOTES_FAILED )
|
- |
|
| 129 |
'End If
|
- |
|
| 130 |
|
- |
|
| 131 |
'Set oExec = Nothing
|
- |
|
| 132 |
Set sysShell = Nothing
|
92 |
Set sysShell = Nothing
|
| - |
|
93 |
|
| - |
|
94 |
If ( rv <> 0 ) then
|
| - |
|
95 |
Call Raise_Event ( enumEVENT_ERROR, "All_Read_Only", "Command Failure: " & rv, "Command :" & login_details &" """& command &"""",enum_RELEASE_NOTES_FAILED )
|
| - |
|
96 |
End If
|
| 133 |
|
97 |
|
| 134 |
End Sub
|
98 |
End Sub
|
| 135 |
'-----------------------------------------------------------------------------------------------------------------
|
99 |
'-----------------------------------------------------------------------------------------------------------------
|
| 136 |
Sub Create_Doc_Folder ( SSpkg_name, SSpkg_version, docFolder )
|
100 |
Sub Create_Doc_Folder ( SSpkg_name, SSpkg_version, docFolder )
|
| 137 |
Dim outMachine, outDpkg_root, outUser, outPassword
|
101 |
Dim outMachine, outDpkg_root, outUser, outPassword, rv
|
| 138 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
102 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
| 139 |
|
103 |
|
| 140 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
104 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
| 141 |
|
105 |
|
| 142 |
' --- Commands to run ---
|
106 |
' --- Commands to run ---
|
| 143 |
' Creates doc folder if required with rwx permissions for all
|
- |
|
| 144 |
command = _
|
107 |
command = _
|
| 145 |
"cd "& pArchive_Path &"/"& SSpkg_name &"/"& SSpkg_version &" && "&_
|
108 |
"sudo ~/sbin/make_docFolder "& pArchive_Path &" '"& SSpkg_name &"' '"& SSpkg_version &"' '" & docFolder &"';"
|
| 146 |
"mkdir -p -m a+rwx "& docFolder &"; "
|
- |
|
| 147 |
|
109 |
|
| 148 |
WScript.Echo command
|
110 |
WScript.Echo command
|
| 149 |
|
111 |
|
| 150 |
' --- SSH client with login details ---
|
112 |
' --- SSH client with login details ---
|
| 151 |
'login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
113 |
login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
| 152 |
login_details = AppPath & WINRSH_EXE &" -q -h "& pRemote_Host &" -l "& outUser &" -p "& outPassword
|
- |
|
| 153 |
|
- |
|
| 154 |
|
114 |
|
| - |
|
115 |
'WScript.Echo login_details &" """& command &""""
|
| 155 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
116 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
| 156 |
sysShell.Run "cmd.exe /c "& login_details &" """& command &"""", 0, True
|
117 |
rv = sysShell.Run ("cmd.exe /c "& login_details &" """& command &"""", 0, True)
|
| - |
|
118 |
Set sysShell = Nothing
|
| - |
|
119 |
|
| - |
|
120 |
If ( rv <> 0 ) then
|
| - |
|
121 |
Call Raise_Event ( enumEVENT_ERROR, "Create_Doc_Folder", "Command Failure: " & rv, "Command :" & login_details &" """& command &"""",enum_RELEASE_NOTES_FAILED )
|
| - |
|
122 |
End If
|
| 157 |
|
123 |
|
| 158 |
'Set oExec = sysShell.Exec( login_details &" """& command &"""" )
|
- |
|
| 159 |
'WScript.Echo "HERE:"& oExec
|
- |
|
| 160 |
'outStrOut = oExec.StdOut.ReadAll
|
- |
|
| 161 |
'outStrErr = oExec.StdErr.ReadAll
|
- |
|
| 162 |
|
124 |
|
| 163 |
'If outStrErr <> "" Then
|
- |
|
| 164 |
' Call Raise_Event ( enumEVENT_ERROR, "[sub:Create_Doc_Folder]", _
|
- |
|
| 165 |
' "user: "& outUser & VBNewLine &_
|
- |
|
| 166 |
' "command: "& command , _
|
- |
|
| 167 |
' outStrErr, enum_RELEASE_NOTES_FAILED )
|
- |
|
| 168 |
'End If
|
- |
|
| 169 |
|
- |
|
| 170 |
'Set oExec = Nothing
|
- |
|
| 171 |
Set sysShell = Nothing
|
- |
|
| 172 |
End Sub
|
125 |
End Sub
|
| 173 |
'-----------------------------------------------------------------------------------------------------------------
|
126 |
'-----------------------------------------------------------------------------------------------------------------
|
| 174 |
Sub Map_Network_Drive ( SSunc, outMappedDrive )
|
127 |
Sub Map_Network_Drive ( SSunc, outMappedDrive )
|
| 175 |
Dim outUser, outPassword
|
128 |
Dim outUser, outPassword
|
| 176 |
Dim ValidDrivesARR, validDrive, UsedDrives
|
129 |
Dim ValidDrivesARR, validDrive, UsedDrives
|
| Line 239... |
Line 192... |
| 239 |
Set WshNetwork = Nothing
|
192 |
Set WshNetwork = Nothing
|
| 240 |
End Sub
|
193 |
End Sub
|
| 241 |
|
194 |
|
| 242 |
'-----------------------------------------------------------------------------------------------------------------
|
195 |
'-----------------------------------------------------------------------------------------------------------------
|
| 243 |
Sub Make_Release_Changed (apkg_name, apkg_version, artag_id, apkg_id, apv_id, aproj_id, amode_id, await)
|
196 |
Sub Make_Release_Changed (apkg_name, apkg_version, artag_id, apkg_id, apv_id, aproj_id, amode_id, await)
|
| 244 |
Dim outUser, outPassword
|
197 |
Dim outUser, outPassword, rv
|
| 245 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
198 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
| 246 |
WScript.Echo "Running release changed script for "& apkg_name & " " & apkg_version
|
199 |
WScript.Echo "Running release changed script for "& apkg_name & " " & apkg_version
|
| 247 |
|
200 |
|
| 248 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
201 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
| 249 |
|
202 |
|
| Line 260... |
Line 213... |
| 260 |
";"
|
213 |
";"
|
| 261 |
|
214 |
|
| 262 |
WScript.Echo command
|
215 |
WScript.Echo command
|
| 263 |
|
216 |
|
| 264 |
' --- SSH client with login details ---
|
217 |
' --- SSH client with login details ---
|
| 265 |
login_details = AppPath & WINRSH_EXE &" -q -h "& pRemote_Host &" -l "& outUser &" -p "& outPassword
|
218 |
login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
| 266 |
|
219 |
|
| - |
|
220 |
'WScript.Echo login_details &" """& command &""""
|
| 267 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
221 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
| 268 |
sysShell.Run "cmd.exe /c "& login_details &" """& command &"""", 0, await
|
222 |
rv = sysShell.Run ("cmd.exe /c "& login_details &" """& command &"""", 0, True)
|
| - |
|
223 |
Set sysShell = Nothing
|
| 269 |
|
224 |
|
| 270 |
Set sysShell = Nothing
|
225 |
If ( rv <> 0 ) then
|
| - |
|
226 |
Call Raise_Event ( enumEVENT_ERROR, "Make_Release_Changed", "Command Failure: " & rv, "Command :" & login_details &" """& command &"""",enum_RELEASE_NOTES_FAILED )
|
| - |
|
227 |
End If
|
| - |
|
228 |
|
| 271 |
|
229 |
|
| 272 |
End Sub
|
230 |
End Sub
|
| 273 |
|
231 |
|
| - |
|
232 |
'-----------------------------------------------------------------------------------------------------------------
|
| - |
|
233 |
Function Test_Pkg_Archive_Access ()
|
| - |
|
234 |
Dim outUser, outPassword, rv, fv
|
| - |
|
235 |
Dim login_details, command, sysShell, oExec, outStrOut, outStrErr
|
| - |
|
236 |
WScript.Echo "Test_Pkg_Archive_Access"
|
| - |
|
237 |
|
| - |
|
238 |
fv = 0
|
| - |
|
239 |
Call Get_Archive_Telnet_Login_Details ( outUser, outPassword )
|
| - |
|
240 |
|
| - |
|
241 |
command = _
|
| - |
|
242 |
"sudo ~/sbin/make_test_access;"
|
| - |
|
243 |
|
| - |
|
244 |
WScript.Echo command
|
| - |
|
245 |
|
| - |
|
246 |
' --- SSH client with login details ---
|
| - |
|
247 |
login_details = AppPath & SSH_EXE &" -ssh -batch "& outUser &"@"& pRemote_Host &" -pw "& outPassword
|
| - |
|
248 |
|
| - |
|
249 |
WScript.Echo login_details &" """& command &""""
|
| - |
|
250 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
| - |
|
251 |
rv = sysShell.Run ("cmd.exe /c "& login_details &" """& command &"""", 0, True)
|
| - |
|
252 |
Set sysShell = Nothing
|
| - |
|
253 |
|
| - |
|
254 |
WScript.Echo "Results: " & rv
|
| - |
|
255 |
If ( rv <> 55 ) then
|
| - |
|
256 |
Call Raise_Event ( enumEVENT_ERROR, "Test_Pkg_Archive_Access", "Command Failure: " & rv, "Command :" & login_details &" """& command &"""",enum_RELEASE_NOTES_FAILED )
|
| - |
|
257 |
fv = 1
|
| - |
|
258 |
End If
|
| - |
|
259 |
|
| - |
|
260 |
Test_Pkg_Archive_Access = fv
|
| - |
|
261 |
|
| - |
|
262 |
End Function
|
| - |
|
263 |
|
| - |
|
264 |
|
| 274 |
End Class
|
265 |
End Class
|
| 275 |
|
266 |
|