添加了删除快照的功能
This commit is contained in:
@@ -25,7 +25,8 @@ management_nodes:
|
||||
|
||||
# 全局策略配置
|
||||
global:
|
||||
snapshot_retention_days: 15 # 可选,使用默认值 15 天
|
||||
snapshot_retention_days: 0 # 可选,使用默认值 15 天
|
||||
# excel_output_path: ./vm_snapshots_report.xlsx # 可选,使用默认值,如:/logs/2026-02-20_14-00-21-VMsSnapShots_report.xlsx
|
||||
# 'excel_output_path',: ./vm_snapshots_report.xlsx # 可选,使用默认值,如:/logs/2026-02-20_14-00-21-VMsSnapShots_report.xlsx
|
||||
# ESXi连接特殊配置(禁用SSL验证,ESXi默认自签证书)
|
||||
disable_ssl_verify: true
|
||||
@@ -17,7 +17,8 @@ def load_config():
|
||||
"SNAPSHOT_RETENTION_DAYS": int(global_config.get('snapshot_retention_days', 15)),
|
||||
# "EXCEL_OUTPUT_PATH": global_config.get('excel_output_path', f'/logs/{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}-VMsSnapShots_report.xlsx'),
|
||||
# "LOG_FILE_PATH": global_config.get('log_file_path', f'/logs/{datetime.now().strftime('%Y%m%d_%H%M%S')}-VMsSnapShots_cleanup.logs'), "EXCEL_OUTPUT_PATH": global_config.get('excel_output_path', f'/logs/{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}-VMsSnapShots_report.xlsx'),
|
||||
"EXCEL_OUTPUT_PATH": global_config.get('excel_output_path', f'D:\\PycharmProjects\\RemoveWeeklyShapshot\\logs\\{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}-VMsSnapShots_report.xlsx'),
|
||||
"EXCEL_OUTPUT_PATH": global_config.get('excel_output_path', f'D:\\PycharmProjects\\RemoveWeeklyShapshot\\output\\{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}-VMsSnapShots_report.xlsx'),
|
||||
"YAML_OUTPUT_PATH": global_config.get('yaml_output_path', f'D:\\PycharmProjects\\RemoveWeeklyShapshot\\output\\{datetime.now().strftime('%Y-%m-%d')}-old_snapshots.yaml'),
|
||||
"DISABLE_SSL_VERIFY": global_config.get('disable_ssl_verify', True),
|
||||
# 算出的过期时间点
|
||||
}
|
||||
@@ -49,6 +50,7 @@ config = load_config() # 模块导入时立即执行
|
||||
MANAGEMENT_NODES = config["MANAGEMENT_NODES"]
|
||||
SNAPSHOT_RETENTION_DAYS = config["SNAPSHOT_RETENTION_DAYS"]
|
||||
EXCEL_OUTPUT_PATH = config["EXCEL_OUTPUT_PATH"]
|
||||
YAML_OUTPUT_PATH = config["YAML_OUTPUT_PATH"]
|
||||
#LOG_FILE_PATH = config["LOG_FILE_PATH"]
|
||||
DISABLE_SSL_VERIFY = config["DISABLE_SSL_VERIFY"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user