Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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