Revert "Backup configuration files before overwriting" (#11269)

* Revert "Adding MotionIP to BinarySensors for HMIP-SMI (#11268)"

This reverts commit c94cc34a8f.

* Revert "Bugfix: 10509 - http is hard coded in plex sensor (#11072)"

This reverts commit 901d4b5489.

* Revert "Fix handling zero values for state_on/state_off (#11264)"

This reverts commit 2e4e3a42cc.

* Revert "Fix inverted sensors on the concord232 binary sensor component (#11261)"

This reverts commit b866687cd7.

* Revert "Proper Steam game names and small fixes (#11182)"

This reverts commit 7faa94046c.

* Revert "Bugfix homematic available modus (#11256)"

This reverts commit 1d579587c1.

* Revert "Fix detection of if a negative node is in use (#11255)"

This reverts commit b28bfad496.

* Revert "added myself to become code owner for miflora and plant (#11251)"

This reverts commit e0682044f0.

* Revert "Add workaround for running tox on Windows platforms (#11188)"

This reverts commit 81f1a65fae.

* Revert "Upgrade to new miflora version 0.2.0 (#11250)"

This reverts commit 8efc4b5ba9.

* Revert "homematic: add username and password to interface config schema (#11214)"

This reverts commit b4e2537de3.

* Revert "Backup configuration files before overwriting (#11216)"

This reverts commit 90e25a6dfb.
This commit is contained in:
Pascal Vizeli
2017-12-21 22:33:37 +01:00
committed by GitHub
parent c94cc34a8f
commit 9e0a765801

View File

@@ -233,68 +233,21 @@ def create_default_config(config_dir, detect_location=True):
config_file.write(DEFAULT_CONFIG) 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: with open(secret_path, 'wt') as secret_file:
secret_file.write(DEFAULT_SECRETS) secret_file.write(DEFAULT_SECRETS)
with open(version_path, 'wt') as version_file: with open(version_path, 'wt') as version_file:
version_file.write(__version__) 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'): with open(group_yaml_path, 'wt'):
pass 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: with open(automation_yaml_path, 'wt') as fil:
fil.write('[]') 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'): with open(script_yaml_path, 'wt'):
pass 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'): with open(customize_yaml_path, 'wt'):
pass pass