Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test clean for resubmission pipeline #1292

Merged
merged 118 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
b882f08
Add first version of cleaning pipeline
maximenoel8 Aug 8, 2024
1ca8c43
Fix issue variable
maximenoel8 Aug 8, 2024
480caee
Update variable issue
maximenoel8 Aug 8, 2024
a1f20bb
Remove useless variable when destroying client
maximenoel8 Aug 8, 2024
0a1deb2
Comment cloning
maximenoel8 Aug 8, 2024
8ce7fa2
Change parameter name
maximenoel8 Aug 8, 2024
3952d72
fix stage issue
maximenoel8 Aug 8, 2024
670015a
fix stage issue
maximenoel8 Aug 8, 2024
6a88f43
Use targeted project file
maximenoel8 Aug 15, 2024
13210d4
Disable api cleaning
maximenoel8 Aug 15, 2024
0472831
Fix command call
maximenoel8 Aug 15, 2024
8fe6b2e
Update env
maximenoel8 Aug 15, 2024
a8c14d1
Move to provo
maximenoel8 Aug 15, 2024
1a6ca22
Add back redeploy method
maximenoel8 Aug 15, 2024
921a84d
Add back testsuite repo and disable redeploy
maximenoel8 Aug 15, 2024
fff8d5a
Enable redeploy
maximenoel8 Aug 15, 2024
cebd678
Only delete
maximenoel8 Aug 18, 2024
f93e594
Add back redeploy
maximenoel8 Aug 19, 2024
e2e4e57
Add back full cleanup
maximenoel8 Aug 21, 2024
a814a1a
Update API
maximenoel8 Aug 21, 2024
daf3df9
Update last main.py program
maximenoel8 Sep 9, 2024
478dddd
update main.tf
maximenoel8 Sep 18, 2024
6cddcfe
Add main.tf cleaner
maximenoel8 Sep 18, 2024
4f8231f
Temporary disable destroying stages
maximenoel8 Sep 18, 2024
0600944
Enable cleaning stages back
maximenoel8 Sep 18, 2024
6c6f932
Change pxy to proxy
maximenoel8 Sep 18, 2024
59dbacc
Change modules definition to class definition for API calls
maximenoel8 Sep 23, 2024
b67ae28
Change modules definition to class definition for API calls
maximenoel8 Sep 23, 2024
4aaf990
Temproary disable redeployment VMs
maximenoel8 Sep 23, 2024
38b5933
FIx argument declaration resource to delete
maximenoel8 Sep 23, 2024
351d8b8
Reenable VMs redeployments
maximenoel8 Sep 23, 2024
8a5ff2e
Update minion list
maximenoel8 Oct 21, 2024
964041c
Add container variable
maximenoel8 Oct 22, 2024
9f8fd95
Fix coma
maximenoel8 Oct 22, 2024
57ae823
Correctly add container_repository
maximenoel8 Oct 22, 2024
0ec7e11
Add container to both calls
maximenoel8 Oct 22, 2024
016aa1e
Add init when cleaning
maximenoel8 Oct 22, 2024
fcc6ef1
don't delete proxy and retail
maximenoel8 Oct 22, 2024
cb04027
Rename tfstate and increase result to keep
maximenoel8 Oct 23, 2024
23667ba
Change targeted_project to choice and have default doing nothing.
maximenoel8 Oct 23, 2024
7efd262
Create separate stage to rename tfstate
maximenoel8 Oct 23, 2024
9a575b3
Add try catch to execute all finally stages
maximenoel8 Oct 23, 2024
2cef053
Change method to get red in jenkins
maximenoel8 Oct 23, 2024
7aa247f
Remove save tf state
maximenoel8 Oct 23, 2024
8d0c8cc
Add delete distributions
maximenoel8 Oct 28, 2024
379e129
Support different versions.
maximenoel8 Oct 28, 2024
ae629fb
Add new variable product version.
maximenoel8 Oct 28, 2024
717e970
Add delete_distributions to choices.
maximenoel8 Oct 28, 2024
9e2846b
Block rebuild option
maximenoel8 Oct 28, 2024
f307d3d
Remove useless parameters
maximenoel8 Oct 28, 2024
781e900
delete sym link
maximenoel8 Oct 28, 2024
5627616
Add log to delete know_hosts
maximenoel8 Oct 29, 2024
9341bfa
Throw error for ssh connection.
maximenoel8 Oct 29, 2024
6bbafad
Transform ssh module into a class and update the main program
maximenoel8 Oct 29, 2024
a84d2f6
Use dictionary to match mode to action
maximenoel8 Oct 29, 2024
3815da6
Remove params from move parameters
maximenoel8 Oct 29, 2024
5dc51c1
Unit tests for api program first version.
maximenoel8 Oct 29, 2024
7aa70ce
Fix unit tests.
maximenoel8 Oct 29, 2024
35ae887
delete init content
maximenoel8 Oct 29, 2024
38cc406
Fix full cleanup method
maximenoel8 Oct 31, 2024
f6321f0
Add documentation for CLI resource manager
maximenoel8 Nov 4, 2024
39fec46
Rename default resource to delete
maximenoel8 Nov 4, 2024
905ebca
Fix api call
maximenoel8 Nov 4, 2024
060989e
Try to add a github action
maximenoel8 Nov 4, 2024
438db0c
Try to add a github action
maximenoel8 Nov 4, 2024
b9983ef
Try to add a github action
maximenoel8 Nov 4, 2024
f496ae7
Rename main program
maximenoel8 Nov 5, 2024
9bb0069
Refactor suse manager cleaner
maximenoel8 Nov 5, 2024
58c0532
Add main program testing and add run tests, update github
maximenoel8 Nov 5, 2024
9867173
Fix path for github action.
maximenoel8 Nov 5, 2024
3a47cf8
Create a generic parameter file.
maximenoel8 Nov 5, 2024
22107e5
Add possibility to clean the proxy. Ask user question.
maximenoel8 Nov 6, 2024
7e5849e
Fix product version selection for uyuni
maximenoel8 Nov 6, 2024
395609e
Add support to uyuni for suse manager cleaner
maximenoel8 Nov 6, 2024
19f28fa
Fix confirm environment cleanup
maximenoel8 Nov 6, 2024
f083cf5
Change text for yes no environment cleanup.
maximenoel8 Nov 6, 2024
123902d
Add possibility to delete default resources artefacts.
maximenoel8 Nov 6, 2024
27e1525
Remove yes / no question
maximenoel8 Nov 6, 2024
27b84e0
Skip channels delete when uyuni
maximenoel8 Nov 6, 2024
eaa86f2
Make targeted path common variables.
maximenoel8 Nov 6, 2024
e59de7f
Add product version to unit test.
maximenoel8 Nov 6, 2024
05044cb
Check uyuni skip
maximenoel8 Nov 6, 2024
5446571
Add server configuration to output.
maximenoel8 Nov 6, 2024
d94da1a
Align = for output
maximenoel8 Nov 6, 2024
ab08a90
Directly extract server name and controller name
maximenoel8 Nov 6, 2024
3e3f083
Remove useless parameter file.
maximenoel8 Nov 6, 2024
749abb5
Update unit test for update custom repositories
maximenoel8 Nov 6, 2024
d534e53
Fix hostname extractor
maximenoel8 Nov 6, 2024
982ec5c
Delete only custom channel for uyuni
maximenoel8 Nov 6, 2024
4d545a2
Execute delete channel again
maximenoel8 Nov 6, 2024
4efe288
Add warning log for uyuni custom channels
maximenoel8 Nov 13, 2024
5296aff
Remove wrong stage name
maximenoel8 Nov 13, 2024
f386c2f
Make copy new custom repository json optional
maximenoel8 Nov 13, 2024
4fe0b91
update with last comments
maximenoel8 Dec 2, 2024
ed69b13
Add weekly pipeline to list
maximenoel8 Dec 3, 2024
f4d6018
Add container repository parameter
maximenoel8 Dec 4, 2024
9230312
Fix github actions
maximenoel8 Dec 9, 2024
2c5e5ec
Rename program
maximenoel8 Dec 10, 2024
140c88a
Update github actions
maximenoel8 Dec 10, 2024
a0f096d
Update pipelines with last comments.
maximenoel8 Dec 10, 2024
12301f9
Fix unit test path
maximenoel8 Dec 10, 2024
cce1179
Fix path issues
maximenoel8 Dec 10, 2024
23287e9
Fix paths for test main program
maximenoel8 Dec 10, 2024
df0a7e6
Fix typo
maximenoel8 Dec 10, 2024
a63b4b2
First new method version for ssh
maximenoel8 Dec 11, 2024
ba80a92
Refactor ssh python program
maximenoel8 Dec 11, 2024
a4208c4
Add action using the new ssh method
maximenoel8 Dec 11, 2024
a7402c6
Rename the api and ssh modules
maximenoel8 Dec 11, 2024
852f8f7
Fix github action
maximenoel8 Dec 11, 2024
1b520a1
Change mock test for new program
maximenoel8 Dec 11, 2024
31e477b
Fix error message
maximenoel8 Dec 11, 2024
08cd6c1
Fix ssh call with product version
maximenoel8 Dec 11, 2024
d885185
Fix error message
maximenoel8 Dec 11, 2024
dfb8024
Remove check on private method
maximenoel8 Dec 11, 2024
b5ffa5b
Fix tool path
maximenoel8 Dec 11, 2024
d389e21
Set the program Call once we have the version and the server hostname.
maximenoel8 Dec 11, 2024
4573c0d
Fix the url extraction
maximenoel8 Dec 11, 2024
e57741d
Convert monitoring server into monitoring to match hostnames.
maximenoel8 Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/test-environment-cleaner-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Validate test environment cleaner

on:
pull_request:
paths:
- 'jenkins_pipelines/scripts/test_environment_cleaner/**'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Validate api manager script
uses: actions/checkout@v2

- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.11'

- name: Install dependencies
run: |
python3.11 -m pip install --upgrade pip
pip3.11 install -r jenkins_pipelines/scripts/test_environment_cleaner/requirements.txt

- name: Run tests
run: cd jenkins_pipelines/scripts/test_environment_cleaner; ./run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
def run(params) {
timestamps {
// Define paths and environment variables for reusability
GString TestEnvironmentCleanerProgram = "${WORKSPACE}/susemanager-ci/jenkins_pipelines/scripts/test_environment_cleaner/test_environment_cleaner_program/TestEnvironmentCleaner.py"
GString resultdir = "${WORKSPACE}/results"
GString resultdirbuild = "${resultdir}/${BUILD_NUMBER}"
GString exports = "export BUILD_NUMBER=${BUILD_NUMBER}; export BUILD_VALIDATION=true; "
String container_repository = params.container_repository ?: null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! I did not know about this syntax in Groovy!

String product_version = null
String controllerHostname = null
String serverHostname = null
GString targetedTfFile = "${WORKSPACE}/../${params.targeted_project}/results/sumaform/main.tf"
GString targetedTfStateFile = "${WORKSPACE}/../${params.targeted_project}/results/sumaform/terraform.tfstate"
GString targetedTerraformDirPath = "${WORKSPACE}/../${params.targeted_project}/results/sumaform/"
GString localSumaformDirPath = "${resultdir}/sumaform/"
GString localTfStateFile = "${localSumaformDirPath}/terraform.tfstate"
GString logFile = "${resultdirbuild}/sumaform.log"

// Construct the --tf-resources-to-delete argument dynamically
ArrayList defaultResourcesToDelete = []
if (params.clean_proxy) {
defaultResourcesToDelete.add('proxy')
}
if (params.clean_monitoring_server) {
defaultResourcesToDelete.add('monitoring-server')
}
if (params.clean_retail) {
defaultResourcesToDelete.add('retail')
}

String defaultResourcesToDeleteArgs = defaultResourcesToDelete.isEmpty() ? '' : "--default-resources-to-delete ${defaultResourcesToDelete.join(' ')}"

GString commonParams = "--outputdir ${resultdir} --tf ${targetedTfFile} --gitfolder ${resultdir}/sumaform"

// Define shared environment variables for terraform calls
GString environmentVars = """
set -x
source /home/jenkins/.credentials
export TF_VAR_CONTAINER_REPOSITORY=${container_repository}
export TERRAFORM=${terraform_bin}
export TERRAFORM_PLUGINS=${terraform_bin_plugins}
"""

try {
stage('Clone terracumber, susemanager-ci and sumaform') {

// Prevent rebuild option
if (currentBuild.getBuildCauses().toString().contains("RebuildCause")) {
error "Rebuild is blocked for this job."
}

// Create a directory to store the build results (if it does not exist). Needed for first run
sh "mkdir -p ${resultdir}"
git url: params.terracumber_gitrepo, branch: params.terracumber_ref
dir("susemanager-ci") {
checkout scm
}

// Clone sumaform
sh "set +x; source /home/jenkins/.credentials set -x; ${WORKSPACE}/terracumber-cli ${commonParams} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync"

// Set product version
if (params.targeted_project.contains("5.0")) {
product_version = '5.0'
} else if (params.targeted_project.contains("4.3")) {
product_version = '4.3'
} else if (params.targeted_project.contains("uyuni")) {
product_version = 'uyuni'
} else if (params.targeted_project.contains("5.1")) {
product_version = '5.1'
} else if (params.targeted_project.contains("head")) {
product_version = 'head'
}
else {
// Use the `error` step instead of `throw`
error("Error: targeted_project must contain either 'head', '5.1', '5.0', '4.3' or uyuni.")
}
}

stage('Confirm Environment Cleanup') {
// Ask the user what environment they are cleaning, ensuring the answer matches params.targeted_project
def environmentChoice = input(
message: 'What environment are you cleaning?',
parameters: [
string(name: 'Environment_Name', description: 'Enter the name of the environment you are cleaning.')
]
)

// Validate that the user entered the correct environment
if (environmentChoice != params.targeted_project) {
error("The environment name entered does not match the targeted project. Aborting pipeline.")
}
}

stage("Copy terraform files from ${params.targeted_project}"){
// Copy tfstate and terraform directory to the result directory
sh """
cp ${targetedTfStateFile} ${localTfStateFile}
cp -r ${targetedTerraformDirPath}.terraform ${localSumaformDirPath}
"""

}

stage("Extract the controller and server hostname") {
try {
controllerHostname = sh(
script: """
set -e
cd ${localSumaformDirPath}
terraform output -json configuration | jq -r '.controller.hostname'
""",
returnStdout: true
).trim()

serverHostname = sh(
script: """
set -e
cd ${localSumaformDirPath}
terraform output -json configuration | jq -r '.server.hostname'
""",
returnStdout: true
).trim()

// Print the values for confirmation
echo "Extracted controller hostname: ${controllerHostname}"
echo "Extracted server hostname: ${serverHostname}"

} catch (Exception e) {
error("Failed to extract hostnames: ${e.message}")
}

}

GString programCall = "${TestEnvironmentCleanerProgram} --url ${serverHostname} --product_version ${product_version} ${defaultResourcesToDeleteArgs} --mode"

stage('Delete the systems') {
sh(script: "${programCall} delete_systems")
}
stage('Delete config projects') {
sh(script: "${programCall} delete_config_projects")
}
stage('Delete software channels') {
sh(script: "${programCall} delete_software_channels")
}
stage('Delete activation keys') {
sh(script: "${programCall} delete_activation_keys")
}
stage('Delete minion users') {
sh(script: "${programCall} delete_users")
}
stage('Delete channel repositories') {
sh(script: "${programCall} delete_repositories")
}
stage('Delete salt keys') {
sh(script: "${programCall} delete_salt_keys")
}

stage('Delete ssh know hosts') {
sh(script: "${TestEnvironmentCleanerProgram} --url ${serverHostname} --product_version ${product_version} --mode delete_known_hosts")
}

stage('Delete distributions folders') {
sh(script: "${TestEnvironmentCleanerProgram} --url ${serverHostname} --product_version ${product_version} --mode delete_distributions")
}

stage('Delete client VMs') {

// Construct the --tf-resources-to-delete argument dynamically
ArrayList tfResourcesToDelete = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can reuse the lists at line 20 and 31.

if (params.clean_proxy) {
tfResourcesToDelete.add('proxy')
}
if (params.clean_monitoring_server) {
tfResourcesToDelete.add('monitoring-server')
}
if (params.clean_retail) {
tfResourcesToDelete.add('retail')
}

// Join the resources into a comma-separated string if there are any to delete
String tfResourcesToDeleteArg = defaultResourcesToDelete.isEmpty() ? '' : "--tf-resources-to-delete ${defaultResourcesToDelete.join(' ')}"

// Execute Terracumber CLI to deploy the environment without clients
sh """
${environmentVars}
set +x
${WORKSPACE}/terracumber-cli ${commonParams} --logfile ${logFile} --init --sumaform-backend ${sumaform_backend} --use-tf-resource-cleaner --init --runstep provision ${tfResourcesToDeleteArg}
"""
}

stage('Redeploy the environment with new client VMs') {

// Run Terracumber to deploy the environment
sh """
${environmentVars}
set +x
${WORKSPACE}/terracumber-cli ${commonParams} --logfile ${resultdirbuild}/sumaform.log --init --sumaform-backend ${sumaform_backend} --runstep provision
"""
}

stage('Copy the new custom repository json file to controller') {
if (params.push_new_custom_repositories) {
// Generate custom_repositories.json file in the workspace from the value passed by parameter
if (params.custom_repositories?.trim()) {
writeFile file: 'custom_repositories.json', text: params.custom_repositories, encoding: "UTF-8"
}

// Generate custom_repositories.json file in the workspace using a Python script - MI Identifiers passed by parameter
if (params.mi_ids?.trim()) {
node('manager-jenkins-node') {
checkout scm
res_python_script_ = sh(script: "python3 jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py --mi_ids ${params.mi_ids}", returnStatus: true)
echo "Build Validation JSON script return code:\n ${json_content}"
if (res_python_script != 0) {
error("MI IDs (${params.mi_ids}) passed by parameter are wrong (or already released)")
}
}
}
sh(script: "${TestEnvironmentCleanerProgram} --url ${controllerHostname} --product_version ${product_version} --mode update_custom_repositories")
}
}

stage('Sanity check') {
sh "${WORKSPACE}/terracumber-cli ${commonParams} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; ${exports} rake cucumber:build_validation_sanity_check'"
}

}
finally {
stage('Copy back tfstate') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh "cp ${localTfStateFile} ${targetedTfStateFile}"
}
}
Comment on lines +229 to +233
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if copying the old tfstate will be enough if there is a failure...
Maybe after that we require another terraform apply :/


stage('Rename tfstate to avoid copying it between runs') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh "mv ${localTfStateFile} ${localTfStateFile}.old"
sh "cp ${localTfStateFile}.old ${resultdirbuild}"
}
}
}
}
}

return this
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env groovy

node {
// Default node
String nodeName = 'sumaform-cucumber'

// Check the value of targeted_project and adjust the nodeName accordingly
if (params.targeted_project.contains('PRV')) {
nodeName = 'sumaform-cucumber-provo' // Use this for PRV projects
} else if (params.targeted_project.contains('NUE')) {
nodeName = 'sumaform-cucumber' // Use this for NUE projects
}

// Run on the selected node
node(nodeName) {
properties([
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '3')),
disableConcurrentBuilds(),
parameters([
choice(name: 'targeted_project', choices: [
'default',
'manager-4.3-qe-build-validation-NUE',
'manager-5.0-qe-build-validation-NUE',
'manager-5.0-qe-build-validation-weekly-NUE',
'uyuni-master-qe-build-validation-NUE',
'manager-4.3-qe-build-validation-PRV',
'manager-5.0-qe-build-validation-PRV',
'uyuni-master-qe-build-validation-PRV'
], description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
string(name: 'terracumber_gitrepo', defaultValue: 'https://github.com/uyuni-project/terracumber.git', description: 'Terracumber Git Repository'),
string(name: 'terracumber_ref', defaultValue: 'master', description: 'Terracumber Git ref (branch, tag...)'),
string(name: 'container_repository', defaultValue: 'registry.suse.de/suse/sle-15-sp6/update/products/manager50/update/containerfile', description: 'Proxy and server container registry'),
booleanParam(name: 'clean_proxy', defaultValue: false, description: 'Clean Proxy, will remove all the artefacts related to Proxy and redeploy Proxy'),
booleanParam(name: 'clean_monitoring_server', defaultValue: false, description: 'Clean Monitoring Server, will remove all the artefacts related to Monitoring Server and redeploy Monitoring Server'),
booleanParam(name: 'clean_retail', defaultValue: false, description: 'Clean Retails artefacts, and redeploy terminal and dhcp if applicable'),
booleanParam(name: 'push_new_custom_repositories', defaultValue: false, description: 'Push the new custom_repositories.json to controller'),
text(name: 'mi_ids', defaultValue: '', description: 'MI Identifiers separated by comma or whitespaces (Option A)'),
text(name: 'custom_repositories', defaultValue: '{}', description: 'MU Repositories in json format (Option B)')
])
])

stage('Checkout pipeline') {
checkout scm
}

// Define environment variables
env.sumaform_backend = 'libvirt'
env.terraform_bin = '/usr/bin/terraform'
env.terraform_bin_plugins = '/usr/bin'

// Load and run the pipeline
def pipeline = load "jenkins_pipelines/environments/common/pipeline-build-validation-cleanup.groovy"
pipeline.run(params)
}
}
37 changes: 37 additions & 0 deletions jenkins_pipelines/scripts/test_environment_cleaner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SUSE Manager API and SSH Management Script

This Python script provides a command-line interface to manage various resources and configurations on a SUSE Manager server through the XML-RPC API and SSH commands.
The script enables testers to perform resource cleanup, SSH-based file management, and update custom repositories remotely.

## Prerequisites

- **Python 3.11**: Ensure Python 3.11 is installed.
- **Dependencies**: Install the required packages using:

```bash
pip3.11 install -r test_environment_cleaner/requirements.txt
```

## Usage

```commandline
python3.11 TestEnvironmentCleaner.py --url <SUSE_Manager_URL> --mode <operation_mode> [options]
```

### Command-Line Arguments

- `--url`: (Required) URL of the SUSE Manager XML-RPC API.
- `--mode`: (Required) Operation mode. Choose one of the following:
`delete_users`: Deletes user accounts.
`delete_activation_keys`: Deletes activation keys.
`delete_config_projects`: Deletes configuration projects.
`delete_software_channels`: Deletes software channels.
`delete_systems`: Deletes managed systems.
`delete_repositories`: Deletes repositories.
`delete_salt_keys`: Deletes Salt keys.
`full_cleanup`: Runs a complete cleanup of selected resources.
`delete_distributions`: Deletes distributions from the server.
`delete_known_hosts`: Deletes known SSH hosts in server.
`update_custom_repositories`: Updates custom repositories in controller.
- `--default-resources-to-delete`: Optional list of resources (proxy, monitoring-server, retail) to enforce deletion during API cleanup operations.
- `--product_version`: SUSE Manager version (head, 5.1, 5.0, 4.3 or uyuni). Used for handling different paths in specific operations.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
argparse
logging
paramiko
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Set the PYTHONPATH to include the necessary directories
export PYTHONPATH=$(pwd)/test_environment_cleaner_program

# Run the tests
python3.11 -m unittest discover -s tests
Loading
Loading