Subversion Repositories DevTools

Rev

Rev 5251 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5251 Rev 5293
Line 103... Line 103...
103
'           apv_id      - Package Identifier
103
'           apv_id      - Package Identifier
104
'           amode_id    - Mode of indication. One of enumRELEASE_CHANGE_MODE_*
104
'           amode_id    - Mode of indication. One of enumRELEASE_CHANGE_MODE_*
105
'           aget_info   - Boolean: true if we need to populate the global variables with pkg info
105
'           aget_info   - Boolean: true if we need to populate the global variables with pkg info
106
'
106
'
107
Sub Run_ReleaseChanged(artag_id,apv_id,amode_id,aget_info)
107
Sub Run_ReleaseChanged(artag_id,apv_id,amode_id,aget_info)
108
    Dim pArchive_Path, sudoCmd, plinkPath, plinkCmd, wCmdLine
108
    Dim pArchive_Path, sudoCmd, rv
109
 
109
 
110
    pArchive_Path = "dpkg_archive"
110
    pArchive_Path = "dpkg_archive"
111
    last_resultCode = -1
111
    last_resultCode = -1
112
 
112
 
113
    if aget_info then
113
    if aget_info then
Line 144... Line 144...
144
         "  pkg_id=" & m_pkg_id &_
144
         "  pkg_id=" & m_pkg_id &_
145
         "  pv_id="& apv_id &_
145
         "  pv_id="& apv_id &_
146
         "  proj_id="& m_proj_id &_
146
         "  proj_id="& m_proj_id &_
147
         "  mode_id="& amode_id
147
         "  mode_id="& amode_id
148
 
148
 
149
    Dim pkgCredentails, uname, upasswd
-
 
150
    pkgCredentails = split(PKGARCHIVE_CREDENTIALS,":")
-
 
151
    uname = pkgCredentails(0)
149
    ' Execute the command
152
    upasswd = pkgCredentails(1)
-
 
153
 
-
 
154
    plinkPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "Release_Manager\scripts\bin\plink.exe"
-
 
155
    plinkCmd =  "-ssh -batch " & uname & "@" & archive_server & " -pw " & upasswd & " ""sudo " & Replace(sudoCmd,Chr(34),Chr(92)&Chr(34)) & ";"""
-
 
156
    wCmdLine =  plinkPath & " " & plinkCmd
-
 
157
 
-
 
158
    Dim objWSH, rv
-
 
159
    Set objWSH = Server.CreateObject("WScript.Shell")
-
 
160
    rv = objWSH.Run (wCmdLine, 0, TRUE)
150
    rv = ExecuteRemoteCommand("~/sbin/make_test_access " & sMsg)
161
    Set objWSH = Nothing
-
 
162
 
151
 
163
    '
152
    '
164
    '   Report Errors
153
    '   Report Errors
165
    '   105 - Package not in archive. Not a real issue
154
    '   105 - Package not in archive. Not a real issue
166
    If rv = 0 OR rv = 105 Then
155
    If rv = 0 OR rv = 105 Then
Line 196... Line 185...
196
  IsReleased = (CInt(Get_Pkg_Area(artagId, apvId)) = CInt(enum_PKG_AREA_RELEASED))
185
  IsReleased = (CInt(Get_Pkg_Area(artagId, apvId)) = CInt(enum_PKG_AREA_RELEASED))
197
End Function
186
End Function
198
 
187
 
199
'-----------------------------------------------------------------------------------------------------------------
188
'-----------------------------------------------------------------------------------------------------------------
200
'   Test Access to the package server
189
'   Test Access to the package server
201
'   Uses a dedicated script onthe target
190
'   Uses a dedicated script on the target
202
'
191
'
203
Sub TestAccess(sMsg)
192
Sub TestAccess(sMsg)
204
    Dim sudoCmd, plinkPath, plinkCmd, wCmdLine
193
    Dim sudoCmd, rv
205
 
194
 
206
    last_resultCode = -1
195
    last_resultCode = -1
207
 
196
 
-
 
197
    ' Execute the command
-
 
198
    rv = ExecuteRemoteCommand("~/sbin/make_test_access " & sMsg)
-
 
199
 
-
 
200
    '
-
 
201
    '   Report Errors. Expecting a '55'
-
 
202
    '
-
 
203
    If  rv = 55 Then
-
 
204
        last_resultCode = 0
-
 
205
    Else
-
 
206
        last_resultCode = 1
-
 
207
        last_errorMsg = "Result Code: " & rv
-
 
208
    End If
-
 
209
 
-
 
210
End Sub
-
 
211
 
-
 
212
'-----------------------------------------------------------------------------------------------------------------
-
 
213
'   Make the Package Writable
-
 
214
'   Primary Purpose is to make a 'Patch' wriable in dpkg_archive
-
 
215
 
-
 
216
'   Uses a dedicated script on the target
-
 
217
'
-
 
218
Sub MakeWritable(artag_id, apv_id)
-
 
219
    Dim pArchive_Path, sudoCmd, rv
-
 
220
 
-
 
221
    pArchive_Path = "dpkg_archive"
-
 
222
    last_resultCode = -1
-
 
223
 
-
 
224
    Call Get_Package_Info (artag_id,apv_id)
-
 
225
    If Err.Number <> 0 Then
-
 
226
        Report_Event enumEVENT_ERROR, "make_writable", last_errorMsg, "Get_Package_Info:" & Err.Description
-
 
227
        Exit Sub
-
 
228
    End If
-
 
229
 
-
 
230
    ' Ensure that we have some data
-
 
231
    If not m_data_collected Then
-
 
232
        Report_Event enumEVENT_ERROR, "make_writable", "", "Package Info not present"
-
 
233
        Exit Sub
-
 
234
    End If
-
 
235
 
-
 
236
 
208
    ' Build up the command line to the target script
237
    ' Build up the command line to the target script
209
    ' Note: DoubleQuotes quotes will be escaped \"
238
    ' Note: DoubleQuotes quotes will be escaped \"
210
    '       Double space will be process as <ret> for error reporting
239
    '       Double space will be process as <ret> for error reporting
211
    ' Chr(92) == \
240
    ' Chr(92) == \
212
    ' Chr(34) == "
241
    ' Chr(34) == "
213
    ' Chr(39) = '
242
    ' Chr(39) = '
214
    sudoCmd = "~/sbin/make_test_access " & sMsg
243
    sudoCmd = "~/sbin/make_writable" &_
-
 
244
     "  " & pArchive_Path &_
-
 
245
     "  '" & m_pkg_name & "'" &_
-
 
246
     "  '" & m_pkg_version & "'"
-
 
247
 
-
 
248
    ' Execute the command
-
 
249
    rv = ExecuteRemoteCommand(sudoCmd)
-
 
250
 
-
 
251
    '
-
 
252
    '   Report Errors
-
 
253
    If rv = 0 Then
-
 
254
        last_resultCode = 0
-
 
255
    Else
-
 
256
        last_resultCode = 1
-
 
257
        Report_Event enumEVENT_ERROR, "make_writable", Replace(sudoCmd,"  ", VBNewLine), "Remote command on pkg server reported:"  & rv
-
 
258
    End If
-
 
259
 
-
 
260
End Sub
215
 
261
 
-
 
262
'-----------------------------------------------------------------------------------------------------------------
-
 
263
'   Make the Package UnWritable
-
 
264
'   Primary Purpose is to make a 'Patch' wriable in dpkg_archive
-
 
265
 
-
 
266
'   Uses a dedicated script on the target
-
 
267
'
-
 
268
Sub MakeReadOnly(artag_id, apv_id)
-
 
269
    Dim pArchive_Path, sudoCmd, rv
-
 
270
 
-
 
271
    pArchive_Path = "dpkg_archive"
-
 
272
    last_resultCode = -1
-
 
273
 
-
 
274
    Call Get_Package_Info (artag_id,apv_id)
-
 
275
    If Err.Number <> 0 Then
-
 
276
        Report_Event enumEVENT_ERROR, "make_readonly", last_errorMsg, "Get_Package_Info:" & Err.Description
-
 
277
        Exit Sub
-
 
278
    End If
-
 
279
 
-
 
280
    ' Ensure that we have some data
-
 
281
    If not m_data_collected Then
-
 
282
        Report_Event enumEVENT_ERROR, "make_readonly", "", "Package Info not present"
-
 
283
        Exit Sub
-
 
284
    End If
-
 
285
 
-
 
286
    ' Build up the command line to the target script
-
 
287
    ' Note: DoubleQuotes quotes will be escaped \"
-
 
288
    '       Double space will be process as <ret> for error reporting
-
 
289
    ' Chr(92) == \
-
 
290
    ' Chr(34) == "
-
 
291
    ' Chr(39) = '
-
 
292
    sudoCmd = "~/sbin/make_readonly" &_
-
 
293
     "  " & pArchive_Path &_
-
 
294
     "  '" & m_pkg_name & "'" &_
-
 
295
     "  '" & m_pkg_version & "'"
-
 
296
 
-
 
297
 
-
 
298
    ' Execute the command
-
 
299
    rv = ExecuteRemoteCommand(sudoCmd)
-
 
300
 
-
 
301
    '
-
 
302
    '   Report Errors
-
 
303
    If rv = 0 Then
-
 
304
        last_resultCode = 0
-
 
305
    Else
-
 
306
        last_resultCode = 1
-
 
307
        Report_Event enumEVENT_ERROR, "make_readonly", Replace(sudoCmd,"  ", VBNewLine), "Remote command on pkg server reported:"  & rv
-
 
308
    End If
-
 
309
 
-
 
310
End Sub
-
 
311
 
-
 
312
'-----------------------------------------------------------------------------------------------------------------
-
 
313
'   Run a remote command in an ssh session
-
 
314
'
-
 
315
'   Performs command line processing
-
 
316
'   Note: DoubleQuotes quotes will be escaped \"
-
 
317
'   Chr(92) == \
-
 
318
'   Chr(34) == "
-
 
319
'   Chr(39) = '
-
 
320
'
-
 
321
Private Function ExecuteRemoteCommand(sudoCmd)
-
 
322
    Dim plinkPath, plinkCmd, wCmdLine
216
    Dim pkgCredentails, uname, upasswd
323
    Dim pkgCredentails, uname, upasswd
-
 
324
 
217
    pkgCredentails = split(PKGARCHIVE_CREDENTIALS,":")
325
    pkgCredentails = split(PKGARCHIVE_CREDENTIALS,":")
218
    uname = pkgCredentails(0)
326
    uname = pkgCredentails(0)
219
    upasswd = pkgCredentails(1)
327
    upasswd = pkgCredentails(1)
220
 
328
 
221
    plinkPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "Release_Manager\scripts\bin\plink.exe"
329
    plinkPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "Release_Manager\scripts\bin\plink.exe"
222
    plinkCmd =  "-ssh -batch " & uname & "@" & archive_server & " -pw " & upasswd & " ""sudo " & Replace(sudoCmd,Chr(34),Chr(92)&Chr(34)) & ";"""
330
    plinkCmd =  "-ssh -batch " & uname & "@" & archive_server & " -pw " & upasswd & " ""sudo " & Replace(sudoCmd,Chr(34),Chr(92)&Chr(34)) & ";"""
223
    wCmdLine =  plinkPath & " " & plinkCmd
331
    wCmdLine =  plinkPath & " " & plinkCmd
224
 
332
 
225
    Dim objWSH, rv
333
    Dim objWSH, rv
226
    Set objWSH = Server.CreateObject("WScript.Shell")
334
    Set objWSH = Server.CreateObject("WScript.Shell")
227
    rv = objWSH.Run (wCmdLine, 0, TRUE)
335
    ExecuteRemoteCommand = objWSH.Run (wCmdLine, 0, TRUE)
228
    Set objWSH = Nothing
336
    Set objWSH = Nothing
229
 
337
 
230
    '
-
 
231
    '   Report Errors. Expecting a '55'
-
 
232
    '
-
 
233
    If  rv = 55 Then
-
 
234
        last_resultCode = 0
-
 
235
    Else
-
 
236
        last_resultCode = 1
-
 
237
        last_errorMsg = "Result Code: " & rv
-
 
238
    End If
-
 
239
 
-
 
240
End Sub
338
End Function
241
 
-
 
242
 
339
 
243
End Class
340
End Class
244
%>
341
%>