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

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

This reverts commit c94cc34a8f350dcf6f3ca770af11ab772a90e317.

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

This reverts commit 901d4b54891cea21e4f91b6ff67659e9b2c4a60b.

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

This reverts commit 2e4e3a42cc9c86d931e6d0e4a363fdb476403075.

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

This reverts commit b866687cd794266f9b82794e3a77016c82381d53.

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

This reverts commit 7faa94046c9c73f744bdde7fa0dde4749b363df1.

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

This reverts commit 1d579587c1d6605f144fb98f23935d7a40993660.

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

This reverts commit b28bfad496c736f4d58f629e20a273e5dab50b9e.

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

This reverts commit e0682044f0587c9ab806a4f626f64ed7c841a0e4.

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

This reverts commit 81f1a65faef069ce8eb7a3c646ce55cebf974866.

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

This reverts commit 8efc4b5ba99e2c2554f335fcadbdd13831a69155.

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

This reverts commit b4e2537de34b60b8fc37c6439f6c06b95d4617de.

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

This reverts commit 90e25a6dfbf64c6e569fabe32494154e3d916979.
This commit is contained in:
Pascal Vizeli 2017-12-21 22:33:37 +01:00 committed by GitHub
parent c94cc34a8f
commit 9e0a765801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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