xref: /aosp_15_r20/tools/acloud/hostcleanup/hostcleanup.py (revision 800a58d989c669b8eb8a71d8df53b1ba3d411444)
1*800a58d9SAndroid Build Coastguard Worker# Copyright 2021 - The Android Open Source Project
2*800a58d9SAndroid Build Coastguard Worker#
3*800a58d9SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*800a58d9SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*800a58d9SAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*800a58d9SAndroid Build Coastguard Worker#
7*800a58d9SAndroid Build Coastguard Worker#     http://www.apache.org/licenses/LICENSE-2.0
8*800a58d9SAndroid Build Coastguard Worker#
9*800a58d9SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*800a58d9SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*800a58d9SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*800a58d9SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*800a58d9SAndroid Build Coastguard Worker# limitations under the License.
14*800a58d9SAndroid Build Coastguard Workerr"""Hostcleanup entry point.
15*800a58d9SAndroid Build Coastguard Worker
16*800a58d9SAndroid Build Coastguard WorkerHostcleanup will rollback acloud host setup steps.
17*800a58d9SAndroid Build Coastguard Worker"""
18*800a58d9SAndroid Build Coastguard Workerfrom acloud.hostcleanup import host_cleanup_runner
19*800a58d9SAndroid Build Coastguard Worker
20*800a58d9SAndroid Build Coastguard Workerdef Run(args):
21*800a58d9SAndroid Build Coastguard Worker    """Run Hostcleanup.
22*800a58d9SAndroid Build Coastguard Worker
23*800a58d9SAndroid Build Coastguard Worker    Hostcleanup options:
24*800a58d9SAndroid Build Coastguard Worker        -cleanup_pkgs: Uninstall packages.
25*800a58d9SAndroid Build Coastguard Worker
26*800a58d9SAndroid Build Coastguard Worker    Args:
27*800a58d9SAndroid Build Coastguard Worker        args: Namespace object from argparse.parse_args.
28*800a58d9SAndroid Build Coastguard Worker    """
29*800a58d9SAndroid Build Coastguard Worker    # TODO(b/145763747): Need to implement cleanup configs and usergroup.
30*800a58d9SAndroid Build Coastguard Worker    if args.cleanup_pkgs:
31*800a58d9SAndroid Build Coastguard Worker        host_cleanup_runner.PackagesUninstaller().Run()
32