| 119 |
ghuddy |
1 |
Option Explicit
|
|
|
2 |
'=====================================================
|
| 133 |
ghuddy |
3 |
' Name: common_subs.vbs
|
|
|
4 |
' Description: Contains list of common subs and functions
|
| 119 |
ghuddy |
5 |
'=====================================================
|
|
|
6 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
7 |
' NOTE: This is NOT USED
|
|
|
8 |
' It is here only to satisfy Application variable in asp which VBS don't know about
|
| 1288 |
dpurdie |
9 |
'
|
|
|
10 |
' Within IIS these data items are provide by global.asa, which is in the root
|
|
|
11 |
' of the IIS server.
|
|
|
12 |
'
|
| 119 |
ghuddy |
13 |
Function Application( sParam )
|
| 133 |
ghuddy |
14 |
If sParam = "TNS_NAME" Then
|
|
|
15 |
Application = ""
|
|
|
16 |
ElseIf sParam = "RELEASE_MANAGER_LOGIN" Then
|
|
|
17 |
Application = ""
|
|
|
18 |
End If
|
| 119 |
ghuddy |
19 |
End Function
|
|
|
20 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
21 |
Function ReadFile( SSpath )
|
| 133 |
ghuddy |
22 |
Dim filesys, rfile
|
|
|
23 |
Set filesys = CreateObject("Scripting.FileSystemObject")
|
|
|
24 |
|
|
|
25 |
On Error Resume Next
|
|
|
26 |
If filesys.FileExists ( SSpath ) Then
|
|
|
27 |
Set rfile = filesys.OpenTextFile( SSpath, 1, false)
|
|
|
28 |
ReadFile = rfile.ReadAll
|
|
|
29 |
rfile.close
|
| 119 |
ghuddy |
30 |
Else
|
|
|
31 |
Call Raise_Event ( enumEVENT_ERROR, "[sub:ReadFile]", _
|
| 133 |
ghuddy |
32 |
"File: "& SSpath, _
|
|
|
33 |
"File not found!", enum_RELEASE_NOTES_FAILED )
|
| 119 |
ghuddy |
34 |
End If
|
| 133 |
ghuddy |
35 |
|
|
|
36 |
Call ErrorCheck ( "[sub:ReadFile]", NULL )
|
|
|
37 |
|
|
|
38 |
Set filesys = nothing
|
| 119 |
ghuddy |
39 |
End Function
|
|
|
40 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
41 |
Sub SaveFile( SSpath, SSfilename, SScontent )
|
| 133 |
ghuddy |
42 |
Dim filesys, filetxt
|
|
|
43 |
Set filesys = CreateObject("Scripting.FileSystemObject")
|
|
|
44 |
WScript.Echo "Saving file "& SSpath &"\"& SSfilename &" ..."
|
|
|
45 |
|
|
|
46 |
On Error Resume Next
|
|
|
47 |
Set filetxt = filesys.CreateTextFile( SSpath &"\"& SSfilename, True )
|
|
|
48 |
filetxt.WriteLine(SScontent)
|
|
|
49 |
filetxt.Close
|
|
|
50 |
|
|
|
51 |
Call ErrorCheck ( "[sub:SaveFile]", NULL )
|
|
|
52 |
|
|
|
53 |
WScript.Echo "File Saved: "& SSpath &"\"& SSfilename
|
|
|
54 |
Set filetxt = nothing
|
|
|
55 |
Set filesys = nothing
|
| 119 |
ghuddy |
56 |
End Sub
|
|
|
57 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
58 |
Sub DeleteFile( SSpath )
|
| 133 |
ghuddy |
59 |
Dim filesys
|
|
|
60 |
Set filesys = CreateObject("Scripting.FileSystemObject")
|
|
|
61 |
If filesys.FileExists(SSpath) Then
|
|
|
62 |
filesys.DeleteFile SSpath
|
|
|
63 |
End If
|
|
|
64 |
Set filesys = nothing
|
| 119 |
ghuddy |
65 |
End Sub
|
|
|
66 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
67 |
Sub DeleteFolder( SSpath )
|
| 133 |
ghuddy |
68 |
Dim filesys
|
|
|
69 |
Set filesys = CreateObject ("Scripting.FileSystemObject")
|
|
|
70 |
If filesys.FolderExists( SSpath ) Then
|
|
|
71 |
filesys.DeleteFolder SSpath, TRUE
|
|
|
72 |
End If
|
| 119 |
ghuddy |
73 |
End Sub
|
|
|
74 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
75 |
Function Folder_Is_Empty ( sPath )
|
| 133 |
ghuddy |
76 |
Dim filesys, oFolder
|
|
|
77 |
Set filesys = CreateObject("Scripting.FileSystemObject")
|
|
|
78 |
|
|
|
79 |
If filesys.FolderExists( sPath ) Then
|
|
|
80 |
Set oFolder = filesys.GetFolder( sPath )
|
|
|
81 |
If ( oFolder.Files.Count + oFolder.SubFolders.Count ) > 0 Then
|
|
|
82 |
Folder_Is_Empty = FALSE
|
|
|
83 |
Else
|
|
|
84 |
Folder_Is_Empty = TRUE
|
|
|
85 |
End If
|
|
|
86 |
Else
|
|
|
87 |
Folder_Is_Empty = TRUE
|
|
|
88 |
End If
|
|
|
89 |
|
| 119 |
ghuddy |
90 |
End Function
|
|
|
91 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
92 |
Function NVL ( SSvalue )
|
| 133 |
ghuddy |
93 |
If IsNull(SSvalue) Or SSvalue = "" Then
|
|
|
94 |
NVL = " "
|
|
|
95 |
Else
|
|
|
96 |
NVL = SSvalue
|
|
|
97 |
End If
|
| 119 |
ghuddy |
98 |
End Function
|
|
|
99 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
100 |
Function Format_FileName( sPkg_name, sPkg_version, nPv_id )
|
| 133 |
ghuddy |
101 |
Dim name, version
|
|
|
102 |
name = Replace( sPkg_name, " ", "_")
|
|
|
103 |
version = Replace( sPkg_version, " ", "")
|
|
|
104 |
version = Replace( version, ".", "_")
|
|
|
105 |
|
|
|
106 |
Format_FileName = RELESE_NOTES_PERFIX &"_"& nPv_id &"_"& name &"_"& version &".html"
|
| 119 |
ghuddy |
107 |
End Function
|
|
|
108 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
109 |
Function Get_Application_Path ()
|
| 133 |
ghuddy |
110 |
Dim tempSTR
|
|
|
111 |
tempSTR = WScript.ScriptFullName
|
| 119 |
ghuddy |
112 |
|
| 133 |
ghuddy |
113 |
Get_Application_Path = Left( tempSTR, InStrRev( tempSTR, "\", InStrRev( tempSTR, "\" ) -1 ) )
|
| 119 |
ghuddy |
114 |
End Function
|
|
|
115 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
116 |
Sub Include_File ( SSFile )
|
| 133 |
ghuddy |
117 |
Dim myInclude
|
|
|
118 |
myInclude = ReadFile( SSFile )
|
|
|
119 |
myInclude = Replace ( myInclude, "<%", "" ) ' Remove ASP tags
|
|
|
120 |
myInclude = Replace ( myInclude, "%>", "" ) ' Remove ASP tags
|
|
|
121 |
Execute( myInclude )
|
| 119 |
ghuddy |
122 |
End Sub
|
|
|
123 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
124 |
Sub CRC_cksum ( SSfile_name, outCRC, outSize )
|
| 133 |
ghuddy |
125 |
Dim sysShell, crcDump, oExec, outStdErr, outStrOut, crcARR
|
|
|
126 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
Set oExec = sysShell.Exec( AppPath & CKSUM_EXE &" """& SSfile_name &"""" )
|
|
|
130 |
|
|
|
131 |
outStdErr = oExec.StdErr.ReadLine
|
|
|
132 |
outStrOut = oExec.StdOut.ReadLine
|
|
|
133 |
|
|
|
134 |
If outStdErr = "" Then
|
|
|
135 |
crcDump = Trim( outStrOut )
|
|
|
136 |
crcDump = Replace ( crcDump, VBNewLine, "" ) ' Remove newline characters
|
|
|
137 |
While InStr( crcDump, " ") > 0
|
|
|
138 |
crcDump = Replace ( crcDump, " ", " " ) ' Ensure single space between items
|
|
|
139 |
Wend
|
|
|
140 |
|
|
|
141 |
crcARR = Split ( crcDump, " " ) ' Split with space
|
|
|
142 |
outCRC = crcARR(0)
|
|
|
143 |
outSize = crcARR(1)
|
|
|
144 |
Else
|
|
|
145 |
outCRC = -1 ' Error occuerd during cksum. Can be no read permissions
|
|
|
146 |
outSize = -1
|
|
|
147 |
End If
|
|
|
148 |
|
|
|
149 |
Set sysShell = nothing
|
| 119 |
ghuddy |
150 |
End Sub
|
|
|
151 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
152 |
Sub CRC_modcrc ( SSfile_name, SSfile_path, outCRC, outSize )
|
| 133 |
ghuddy |
153 |
Dim sysShell, crcDump, oExec, outStdErr, outStrOut, crcARR
|
|
|
154 |
Set sysShell = WScript.CreateObject("WScript.Shell")
|
| 119 |
ghuddy |
155 |
|
| 133 |
ghuddy |
156 |
Set oExec = sysShell.Exec( AppPath & MODCRC_EXE &" -m="& SSfile_path & SSfile_name &" -i=thx" )
|
|
|
157 |
|
|
|
158 |
outStdErr = oExec.StdErr.ReadLine
|
|
|
159 |
outStrOut = oExec.StdOut.ReadLine
|
|
|
160 |
|
|
|
161 |
If outStdErr = "" Then
|
|
|
162 |
crcDump = Trim( outStrOut )
|
|
|
163 |
crcDump = Replace ( crcDump, VBNewLine, "" ) ' Remove newline characters
|
|
|
164 |
While InStr( crcDump, " ") > 0
|
|
|
165 |
crcDump = Replace ( crcDump, " ", " " ) ' Ensure single space between items
|
|
|
166 |
Wend
|
|
|
167 |
|
|
|
168 |
crcARR = Split ( crcDump, " " ) ' Split with space
|
|
|
169 |
outCRC = crcARR(4)
|
|
|
170 |
outSize = crcARR(6)
|
|
|
171 |
Else
|
|
|
172 |
outCRC = -1 ' Error occuerd during cksum. Can be no read permissions
|
|
|
173 |
outSize = -1
|
|
|
174 |
End If
|
|
|
175 |
|
|
|
176 |
Set sysShell = nothing
|
| 119 |
ghuddy |
177 |
End Sub
|
|
|
178 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
179 |
Sub Raise_Event ( eventType, SSlocation, SSvalues, SSerror_message, sDBmsg )
|
| 133 |
ghuddy |
180 |
Dim WshShell, WshNetwork, objArgs, i, agrSTR, SSmsg
|
|
|
181 |
Set WshShell = WScript.CreateObject("WScript.Shell")
|
|
|
182 |
Set WshNetwork = WScript.CreateObject("WScript.Network")
|
|
|
183 |
|
|
|
184 |
Set objArgs = WScript.Arguments
|
|
|
185 |
For i = 0 to objArgs.Count - 1
|
|
|
186 |
agrSTR = agrSTR & objArgs(i) & VBNewLine
|
|
|
187 |
Next
|
|
|
188 |
|
|
|
189 |
' Compose Message
|
|
|
190 |
SSmsg = _
|
|
|
191 |
"-- Script Info --"& VBNewLine &_
|
|
|
192 |
"Host Name: "& WshNetwork.ComputerName & VBNewLine &_
|
|
|
193 |
"Script Name: "& WScript.ScriptName & VBNewLine & VBNewLine &_
|
|
|
194 |
"-- Script Parameters --"& VBNewLine &_
|
|
|
195 |
agrSTR &_
|
|
|
196 |
VBNewLine &_
|
|
|
197 |
"-- Error Location --"& VBNewLine &_
|
|
|
198 |
SSlocation & VBNewLine &_
|
|
|
199 |
VBNewLine &_
|
|
|
200 |
"-- Values --"& VBNewLine &_
|
|
|
201 |
SSvalues & VBNewLine &_
|
|
|
202 |
VBNewLine &_
|
|
|
203 |
"-- Error Message --"& VBNewLine &_
|
|
|
204 |
SSerror_message & VBNewLine
|
|
|
205 |
|
|
|
206 |
'-- Raise this message at these places...
|
|
|
207 |
Wscript.Echo SSmsg
|
|
|
208 |
WshShell.LogEvent eventType, SSmsg
|
|
|
209 |
'Call Alert_Admin ( SSmsg )
|
|
|
210 |
'----------------------------------------
|
|
|
211 |
|
|
|
212 |
Set WshShell = Nothing
|
|
|
213 |
|
|
|
214 |
If Not IsNull(sDBmsg) Then Call Write_To_Release_Notes_Info ( parPv_id, sDBmsg )
|
|
|
215 |
If eventType = enumEVENT_ERROR Then WScript.Quit ' Only Quit if ERROR
|
|
|
216 |
|
| 119 |
ghuddy |
217 |
End Sub
|
|
|
218 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
219 |
Sub ErrorCheck ( ERRlocation, ERRvals )
|
| 133 |
ghuddy |
220 |
If Err.Number <> 0 Then
|
|
|
221 |
Call Raise_Event ( enumEVENT_ERROR, ERRlocation, ERRvals, Err.Source &" "& Err.Description, enum_RELEASE_NOTES_FAILED )
|
|
|
222 |
End If
|
|
|
223 |
Err.Clear
|
| 119 |
ghuddy |
224 |
End Sub
|
|
|
225 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
226 |
Sub Alert_Admin ( SSmsg )
|
| 133 |
ghuddy |
227 |
'Call Send_Email ( adminEmail, adminEmail, "Windows Script Alert!", SSmsg )
|
| 119 |
ghuddy |
228 |
End Sub
|
|
|
229 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
230 |
Sub Send_Email ( SSfrom, SSto, SSsubject, SSbody )
|
| 133 |
ghuddy |
231 |
'Dim objCDOMail
|
|
|
232 |
'Set objCDOMail = CreateObject("CDONTS.NewMail")
|
|
|
233 |
''objCDOMail.From = Request.Form("firstName") & " " & Request.Form("lastName") & " <" & strReturnEmailAddress & ">"
|
|
|
234 |
'objCDOMail.From = SSfrom
|
|
|
235 |
'objCDOMail.To = SSto
|
|
|
236 |
''objCDOMail.Cc = strCCEmailAddress
|
|
|
237 |
''objCDOMail.Bcc = strBCCEmailAddress
|
|
|
238 |
'objCDOMail.Subject = SSsubject
|
|
|
239 |
'objCDOMail.BodyFormat = 1 ' 0 = HTML, 1 = Plain
|
|
|
240 |
'objCDOMail.MailFormat = 1 ' 0 = MIME, 1 = Text
|
|
|
241 |
'objCDOMail.Importance = 0 ' 0 = High, 1 = Medium, 2 = Low
|
|
|
242 |
''objCDOMail.attachFile ("c:\images\mypicture.gif") ' you can also attach files
|
|
|
243 |
'objCDOMail.Body = SSbody
|
|
|
244 |
''objCDOMail.Send
|
|
|
245 |
'Set objCDOMail = Nothing
|
| 119 |
ghuddy |
246 |
End Sub
|
|
|
247 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
248 |
Sub Get_PV_ID ( SSpkg_name, SSpkg_version, outPV_ID)
|
| 133 |
ghuddy |
249 |
Dim Query_String, rsTemp
|
|
|
250 |
|
|
|
251 |
If outPV_ID <> "" Then Exit Sub ' PV_ID already assigned
|
|
|
252 |
|
|
|
253 |
Query_String = _
|
|
|
254 |
" SELECT pv.pv_id"&_
|
|
|
255 |
" FROM packages pkg,"&_
|
|
|
256 |
" package_versions pv"&_
|
|
|
257 |
" WHERE pv.pkg_id = pkg.pkg_id"&_
|
|
|
258 |
" AND pkg.pkg_name = '"& SSpkg_name &"'"&_
|
|
|
259 |
" AND pv.pkg_version = '"& SSpkg_version &"'"
|
|
|
260 |
Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
261 |
|
|
|
262 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
|
|
263 |
outPV_ID = rsTemp("pv_id")
|
|
|
264 |
Else
|
|
|
265 |
Call Raise_Event ( enumEVENT_ERROR, "[sub:Get_PV_ID]", _
|
|
|
266 |
"pkg_name: "& SSpkg_name & VBNewLine &_
|
|
|
267 |
"pkg_version: "& SSpkg_version , _
|
|
|
268 |
"pkg_name and/or pkg_version not found in Release Manager database!", enum_RELEASE_NOTES_FAILED )
|
|
|
269 |
End If
|
|
|
270 |
rsTemp.Close
|
|
|
271 |
Set rsTemp = Nothing
|
| 119 |
ghuddy |
272 |
End Sub
|
|
|
273 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
274 |
Function Get_Package_Type ( NNpv_id )
|
| 133 |
ghuddy |
275 |
Dim Query_String, rsTemp
|
|
|
276 |
|
|
|
277 |
Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_type.sql" )
|
|
|
278 |
OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
279 |
OraDatabase.Parameters.Add "enumBASE_VIEW_PRODUCTS", enumBASE_VIEW_PRODUCTS, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
280 |
Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
281 |
|
|
|
282 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
|
|
283 |
If Not IsNull( rsTemp("message") ) Then
|
|
|
284 |
Get_Package_Type = Eval(rsTemp("message"))
|
|
|
285 |
Else
|
|
|
286 |
Get_Package_Type = enumPKG_TYPE_GENERIC_DPKG
|
|
|
287 |
End If
|
|
|
288 |
Else
|
|
|
289 |
Get_Package_Type = enumPKG_TYPE_GENERIC_DPKG
|
|
|
290 |
End If
|
|
|
291 |
|
|
|
292 |
WScript.Echo "Package Type : "& Get_Package_Type
|
|
|
293 |
|
|
|
294 |
OraDatabase.Parameters.Remove "PV_ID"
|
|
|
295 |
OraDatabase.Parameters.Remove "enumBASE_VIEW_PRODUCTS"
|
|
|
296 |
rsTemp.Close
|
|
|
297 |
Set rsTemp = Nothing
|
| 119 |
ghuddy |
298 |
End Function
|
|
|
299 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
300 |
Sub Get_Pkg_Name_Version ( NNpv_id, outPkg_name, outPkg_version )
|
| 133 |
ghuddy |
301 |
Dim Query_String, rsTemp
|
|
|
302 |
|
|
|
303 |
Query_String = _
|
|
|
304 |
" SELECT pkg.pkg_name, pv.pkg_version"&_
|
|
|
305 |
" FROM packages pkg,"&_
|
|
|
306 |
" package_versions pv"&_
|
|
|
307 |
" WHERE pv.pkg_id = pkg.pkg_id"&_
|
|
|
308 |
" AND pv.pv_id = "& NNpv_id
|
|
|
309 |
Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
310 |
|
|
|
311 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
|
|
312 |
outPkg_name = rsTemp("pkg_name")
|
|
|
313 |
outPkg_version = rsTemp("pkg_version")
|
|
|
314 |
Else
|
|
|
315 |
Call Raise_Event ( enumEVENT_ERROR, "[sub:Get_Pkg_Name_Version]", _
|
|
|
316 |
"PV_ID: "& NNpv_id , _
|
|
|
317 |
"PV_ID not found in Release Manager database!", enum_RELEASE_NOTES_FAILED )
|
|
|
318 |
End If
|
|
|
319 |
|
|
|
320 |
rsTemp.Close
|
|
|
321 |
Set rsTemp = Nothing
|
| 119 |
ghuddy |
322 |
End Sub
|
|
|
323 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
324 |
Sub Check_Requirements_To_Proceed ( nPv_id )
|
| 133 |
ghuddy |
325 |
Dim Query_String, rsPackageVersions, rsRunLevel, rsReleaseConfig, rsReleaseTags
|
|
|
326 |
|
|
|
327 |
' Exit if Release Notyes Generation is forced
|
|
|
328 |
If objArgs.Named.Item("f") <> "" Then Exit Sub
|
|
|
329 |
|
|
|
330 |
Query_String = _
|
|
|
331 |
" SELECT pv.release_notes_info, pv.pkg_id"&_
|
|
|
332 |
" FROM package_versions pv"&_
|
|
|
333 |
" WHERE pv.pv_id = "& nPv_id
|
|
|
334 |
|
|
|
335 |
Set rsPackageVersions = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
336 |
|
|
|
337 |
If rsPackageVersions("release_notes_info") <> enum_RELEASE_NOTES_GENERATING Then
|
|
|
338 |
WScript.Echo "Exiting this job. release_notes_info in [PACKAGE_VERSIONS] table is ("& rsPackageVersions("release_notes_info") &")"
|
|
|
339 |
WScript.Echo "Expected value is ("& enum_RELEASE_NOTES_GENERATING &")"
|
|
|
340 |
Call Raise_Event ( enumEVENT_ERROR, "[sub:Check_Requirements_To_Proceed]", _
|
|
|
341 |
"PV_ID: "& nPv_id , _
|
|
|
342 |
"Exiting this job. release_notes_info in [PACKAGE_VERSIONS] table is ("& rsPackageVersions("release_notes_info") &")", NULL )
|
|
|
343 |
End If
|
|
|
344 |
|
|
|
345 |
' Do not proceed if the build daemon is building a version of the package. This is an attempt to make sure that
|
|
|
346 |
' release notes generation does not cause a problem for the build daemons, such as might be the case if and when
|
|
|
347 |
' it manipulates file ownership later on, etc (see DEVI-48682). This is not a foolproof method to prevent the problem,
|
|
|
348 |
' but it should reduce the likelyhood of it occuring
|
|
|
349 |
Dim mustAbort
|
|
|
350 |
mustAbort = FALSE
|
|
|
351 |
|
|
|
352 |
Query_String = _
|
|
|
353 |
" SELECT * "&_
|
|
|
354 |
" FROM run_level rl"&_
|
|
|
355 |
" WHERE rl.current_pkg_id_being_built = "& rsPackageVersions("pkg_id")
|
|
|
356 |
|
|
|
357 |
Set rsRunLevel = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
358 |
|
|
|
359 |
'For each run_level table entry...
|
|
|
360 |
Do While (NOT rsRunLevel.BOF) AND (NOT rsRunLevel.EOF) AND (mustAbort = FALSE)
|
|
|
361 |
|
|
|
362 |
' Make sure that the release configuration shows that there is a daemon hostname associated with this
|
|
|
363 |
' run_level table entry.
|
|
|
364 |
Query_String = _
|
|
|
365 |
" SELECT rtag_id, daemon_hostname"&_
|
|
|
366 |
" FROM release_config"&_
|
|
|
367 |
" WHERE rcon_id = "& rsRunLevel("rcon_id")
|
|
|
368 |
|
|
|
369 |
Set rsReleaseConfig = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
370 |
If (rsReleaseConfig.RecordCount > 0) AND NOT IsNull(rsReleaseConfig("daemon_hostname")) Then
|
|
|
371 |
' ought to check the validity of the daemon hostname - will have to wait for these to be configured metadata
|
|
|
372 |
' before we can do that though, unless we hard-code the valid names here somewhere.
|
|
|
373 |
' Anyway, the hostname is not null so it looks like the run_level entry is one we cannot dis-regard
|
|
|
374 |
|
|
|
375 |
' if the run level is ACTIVE (3) then abort
|
|
|
376 |
If rsRunLevel("current_run_level") = 3 Then
|
|
|
377 |
mustAbort = TRUE
|
|
|
378 |
Else
|
|
|
379 |
' run level must be WAITING, PAUSED, etc, so examine the official state of the release to see if
|
|
|
380 |
' it is still open in some way
|
|
|
381 |
Query_String = _
|
|
|
382 |
" SELECT official"&_
|
|
|
383 |
" FROM release_tags"&_
|
|
|
384 |
" WHERE rtag_id = "& rsReleaseConfig("rtag_id")
|
|
|
385 |
|
|
|
386 |
Set rsReleaseTags = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
387 |
If (rsReleaseTags.RecordCount > 0) Then
|
|
|
388 |
' If release is not closed or archived
|
|
|
389 |
If NOT (IsNull(rsReleaseTags("official")) OR (rsReleaseTags("official") = "Y") OR (rsReleaseTags("official") = "A")) Then
|
|
|
390 |
' release is still open (OPEN or RESTRICTED, or CCB Mode) so abort
|
|
|
391 |
mustAbort = TRUE
|
|
|
392 |
End If
|
|
|
393 |
End If
|
|
|
394 |
rsReleaseTags.Close
|
|
|
395 |
Set rsReleaseTags = Nothing
|
|
|
396 |
End If
|
|
|
397 |
End If
|
|
|
398 |
|
|
|
399 |
rsReleaseConfig.Close
|
|
|
400 |
Set rsReleaseConfig = Nothing
|
|
|
401 |
|
|
|
402 |
rsRunLevel.MoveNext
|
|
|
403 |
Loop
|
|
|
404 |
|
|
|
405 |
If (mustAbort) Then
|
|
|
406 |
WScript.Echo "Exiting this job. Build Daemon is currently building this/another version of this package."
|
|
|
407 |
WScript.Echo "Try again later."
|
|
|
408 |
Call Raise_Event ( enumEVENT_ERROR, "[sub:Check_Requirements_To_Proceed]", _
|
|
|
409 |
"PV_ID: "& nPv_id & VBNewLine & "PKG_ID: "& rsPackageVersions("pkg_id"), _
|
|
|
410 |
"Exiting this job. Build Daemon is currently building this/another version of this package.", NULL )
|
|
|
411 |
End If
|
|
|
412 |
|
|
|
413 |
rsRunLevel.Close
|
|
|
414 |
Set rsRunLevel = Nothing
|
|
|
415 |
|
|
|
416 |
rsPackageVersions.Close
|
|
|
417 |
Set rsPackageVersions = Nothing
|
|
|
418 |
|
| 119 |
ghuddy |
419 |
End Sub
|
|
|
420 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
421 |
Sub Write_To_Release_Notes_Info ( nPv_id, sMsg )
|
|
|
422 |
WScript.Echo "Writing message to release_notes_info in [PACKAGE_VERSIONS] table."
|
|
|
423 |
OraSession.BeginTrans
|
| 177 |
brianf |
424 |
|
|
|
425 |
If IsNULL(sMsg) Then
|
|
|
426 |
WScript.Echo "NULL"
|
|
|
427 |
OraDatabase.ExecuteSQL " UPDATE package_versions "&_
|
|
|
428 |
" SET release_notes_info = NULL"&_
|
|
|
429 |
" WHERE pv_id = "& nPv_id
|
|
|
430 |
Else
|
|
|
431 |
WScript.Echo sMsg
|
|
|
432 |
OraDatabase.ExecuteSQL " UPDATE package_versions "&_
|
| 133 |
ghuddy |
433 |
" SET release_notes_info = '"& sMsg &"'"&_
|
|
|
434 |
" WHERE pv_id = "& nPv_id
|
| 177 |
brianf |
435 |
End If
|
| 119 |
ghuddy |
436 |
OraSession.CommitTrans
|
|
|
437 |
End Sub
|
|
|
438 |
'-----------------------------------------------------------------------------------------------------------------
|
| 133 |
ghuddy |
439 |
Function FormatTextBox ( SSstr )
|
|
|
440 |
If SSstr <> "" Or NOT IsNull(SSstr) Then
|
|
|
441 |
FormatTextBox = Replace ( SSstr, VBNewLine, "<br>")
|
|
|
442 |
End If
|
| 119 |
ghuddy |
443 |
End Function
|
|
|
444 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
445 |
Function HTML_Encode ( sSTR )
|
|
|
446 |
Dim tempSTR
|
|
|
447 |
tempSTR = sSTR
|
|
|
448 |
If IsNull( tempSTR ) Or tempSTR = "" Then
|
|
|
449 |
HTML_Encode = ""
|
|
|
450 |
Else
|
|
|
451 |
tempSTR = Replace ( tempSTR, "&", "&" )
|
|
|
452 |
tempSTR = Replace ( tempSTR, "<", "<" )
|
|
|
453 |
tempSTR = Replace ( tempSTR, ">", ">" )
|
|
|
454 |
HTML_Encode = tempSTR
|
|
|
455 |
End If
|
|
|
456 |
End Function
|
|
|
457 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
458 |
Function EuroDate ( dDate )
|
| 133 |
ghuddy |
459 |
' Ensures Euro Date format DD/MM/YYYY
|
|
|
460 |
If IsNull(dDate) Then Exit Function
|
|
|
461 |
EuroDate = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate)
|
| 119 |
ghuddy |
462 |
End Function
|
|
|
463 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
464 |
Function EuroDateTime ( dDate )
|
| 133 |
ghuddy |
465 |
' Ensures Euro DateTime format DD/MM/YYYY H24:MIN:SS
|
|
|
466 |
If IsNull(dDate) Then Exit Function
|
|
|
467 |
EuroDateTime = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate) &" "& FormatDateTime( dDate, 4 )
|
| 119 |
ghuddy |
468 |
End Function
|
| 161 |
iaugusti |
469 |
|
| 133 |
ghuddy |
470 |
'-----------------------------------------------------------------------------------------------------------------
|
| 161 |
iaugusti |
471 |
Sub Get_Release_Info (APV_ID, ByRef ARTAG_ID, ByRef APKG_ID)
|
|
|
472 |
Dim Query_String, rsTemp
|
|
|
473 |
|
|
|
474 |
Query_String = _
|
|
|
475 |
" SELECT rc.rtag_id, pv.pkg_id"&_
|
|
|
476 |
" FROM package_versions pv, release_content rc"&_
|
|
|
477 |
" WHERE rc.pv_id = " & APV_ID &_
|
|
|
478 |
" AND pv.pv_id = rc.pv_id"
|
|
|
479 |
|
|
|
480 |
Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
481 |
|
|
|
482 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
|
|
483 |
ARTAG_ID = rsTemp("rtag_id")
|
|
|
484 |
APKG_ID = rsTemp("pkg_id")
|
|
|
485 |
Else
|
|
|
486 |
Call Raise_Event ( enumEVENT_ERROR, "[sub:Get_Release_Info]", _
|
|
|
487 |
"PV_ID: "& APV_ID & VBNewLine ,_
|
|
|
488 |
"pv_id not found in release_content table!", enum_RELEASE_NOTES_FAILED )
|
|
|
489 |
End If
|
|
|
490 |
rsTemp.Close
|
|
|
491 |
Set rsTemp = Nothing
|
|
|
492 |
End Sub
|