mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 05:05:09 +02:00
Revert "Backup configuration files before overwriting" (#11269)
* Revert "Adding MotionIP to BinarySensors for HMIP-SMI (#11268)" This reverts commitc94cc34a8f
. * Revert "Bugfix: 10509 - http is hard coded in plex sensor (#11072)" This reverts commit901d4b5489
. * Revert "Fix handling zero values for state_on/state_off (#11264)" This reverts commit2e4e3a42cc
. * Revert "Fix inverted sensors on the concord232 binary sensor component (#11261)" This reverts commitb866687cd7
. * Revert "Proper Steam game names and small fixes (#11182)" This reverts commit7faa94046c
. * Revert "Bugfix homematic available modus (#11256)" This reverts commit1d579587c1
. * Revert "Fix detection of if a negative node is in use (#11255)" This reverts commitb28bfad496
. * Revert "added myself to become code owner for miflora and plant (#11251)" This reverts commite0682044f0
. * Revert "Add workaround for running tox on Windows platforms (#11188)" This reverts commit81f1a65fae
. * Revert "Upgrade to new miflora version 0.2.0 (#11250)" This reverts commit8efc4b5ba9
. * Revert "homematic: add username and password to interface config schema (#11214)" This reverts commitb4e2537de3
. * Revert "Backup configuration files before overwriting (#11216)" This reverts commit90e25a6dfb
.
This commit is contained in:
@@ -233,68 +233,21 @@ def create_default_config(config_dir, detect_location=True):
|
||||
|
||||
config_file.write(DEFAULT_CONFIG)
|
||||
|
||||
timestamp = date_util.now().strftime('%Y%m%dT%H%M%S')
|
||||
# Check for existing secrets file.
|
||||
# If it exists, back it up before recreating it.
|
||||
if os.path.isfile(secret_path):
|
||||
backup_secret_path = "{}.{}.bak".format(
|
||||
secret_path,
|
||||
timestamp
|
||||
)
|
||||
print("Found existing secrets file. Backing up and re-creating.")
|
||||
os.rename(secret_path, backup_secret_path)
|
||||
with open(secret_path, 'wt') as secret_file:
|
||||
secret_file.write(DEFAULT_SECRETS)
|
||||
|
||||
with open(version_path, 'wt') as version_file:
|
||||
version_file.write(__version__)
|
||||
|
||||
# Check for existing group file.
|
||||
# If it exists, back it up before recreating it.
|
||||
if os.path.isfile(group_yaml_path):
|
||||
backup_group_path = "{}.{}.bak".format(
|
||||
group_yaml_path,
|
||||
timestamp
|
||||
)
|
||||
print("Found existing group file. Backing up and re-creating.")
|
||||
os.rename(group_yaml_path, backup_group_path)
|
||||
with open(group_yaml_path, 'wt'):
|
||||
pass
|
||||
|
||||
# Check for existing automation file.
|
||||
# If it exists, back it up before recreating it.
|
||||
if os.path.isfile(automation_yaml_path):
|
||||
backup_automation_path = "{}.{}.bak".format(
|
||||
automation_yaml_path,
|
||||
timestamp
|
||||
)
|
||||
print("Found existing automation file. Backing up and",
|
||||
"re-creating.")
|
||||
os.rename(automation_yaml_path, backup_automation_path)
|
||||
with open(automation_yaml_path, 'wt') as fil:
|
||||
fil.write('[]')
|
||||
|
||||
# Check for existing group file.
|
||||
# If it exists, back it up before recreating it.
|
||||
if os.path.isfile(script_yaml_path):
|
||||
backup_script_path = "{}.{}.bak".format(
|
||||
script_yaml_path,
|
||||
timestamp
|
||||
)
|
||||
print("Found existing script file. Backing up and re-creating.")
|
||||
os.rename(script_yaml_path, backup_script_path)
|
||||
with open(script_yaml_path, 'wt'):
|
||||
pass
|
||||
|
||||
# Check for existing customize file.
|
||||
# If it exists, back it up before recreating it.
|
||||
if os.path.isfile(customize_yaml_path):
|
||||
backup_customize_path = "{}.{}.bak".format(
|
||||
customize_yaml_path,
|
||||
timestamp
|
||||
)
|
||||
print("Found existing customize file. Backing up and re-creating.")
|
||||
os.rename(customize_yaml_path, backup_customize_path)
|
||||
with open(customize_yaml_path, 'wt'):
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user