Skip to content

Commit

Permalink
Revert "Backup configuration files before overwriting (#11216)"
Browse files Browse the repository at this point in the history
This reverts commit 90e25a6.
  • Loading branch information
pvizeli committed Dec 21, 2017
1 parent b2310dc commit 5f7255e
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions homeassistant/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5f7255e

Please sign in to comment.