-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unregister from SCC after job is stopped
We need to consider canceled & failed jobs, so de-registration must be performed from worker. It needs username & password that are generated during registration and exported into SCC_DEREGISTER variable. Worker unregister from scc using by calling SCC url with: DELETE /connect/systems There is a short window between system registration and set_var("SCC_DEREGISTER"), when system would not unregister. Tested by: - Following logs in /var/lib/openqa/pool/<worker>/autoinst-log.txt - By canceling jobs before/during/after registration or finishing them - Checking that SCC keys are removed from scc.suse.com (Alpha Keys)
- Loading branch information
Showing
3 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright © 2016 SUSE LLC | ||
# | ||
# Copying and distribution of this file, with or without modification, | ||
# are permitted in any medium without royalty provided the copyright | ||
# notice and this notice are preserved. This file is offered as-is, | ||
# without any warranty. | ||
|
||
use strict; | ||
use warnings; | ||
use testapi; | ||
use LWP::UserAgent; | ||
|
||
# poo#11518 - deregister system after job finishes | ||
if (get_var("SCC_DEREGISTER")) { | ||
diag "de-registration from SCC"; | ||
|
||
my @credentials = split /\r\n/, get_var("SCC_DEREGISTER"); | ||
|
||
my $ua = LWP::UserAgent->new; | ||
$ua->credentials('scc.suse.com:443', 'SCC Connect API', $credentials[0], $credentials[1]); | ||
my $response = $ua->delete('https://scc.suse.com/connect/systems'); | ||
|
||
if (!$response->is_success) { | ||
die $response->status_line; | ||
} | ||
} | ||
else { | ||
diag "de-registration not needed"; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters