Start of migration framework, to allow moving of files in the config …#7740
Conversation
|
@infamy, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @robbiet480 and @fabaff to be potential reviewers. |
…directory to be hidden, ios.conf used as the first one to undergo this change.
tgurr
left a comment
There was a problem hiding this comment.
Non code related comments, just some wrong spellings and a small note, one time it reads
- "Test migrate of config"
and one time - "Test not migrating of config"
it should probably be either migrate or migrating in both cases.
| @mock.patch('homeassistant.config.shutil') | ||
| @mock.patch('homeassistant.config.os') | ||
| def test_migrate_file_on_upgrade(self, mock_os, mock_shutil): | ||
| """Test miragte of config files on upgrade.""" |
| @mock.patch('homeassistant.config.shutil') | ||
| @mock.patch('homeassistant.config.os') | ||
| def test_migrate_no_file_on_upgrade(self, mock_os, mock_shutil): | ||
| """Test not mirgating confgi files on upgrade.""" |
There was a problem hiding this comment.
spelling: mirgating -> migrating; confgi -> config
|
Good spot, will correct. |
| outp.write(__version__) | ||
|
|
||
| _LOGGER.info('Migrating old system config files to new locations') | ||
| for mfile in FILE_MIGRATION: |
There was a problem hiding this comment.
for oldf, newf in FILE_MIGRATION:
|
Why do we need hidden files in a hidden directory? |
|
@MartinHjelmare this is to hide the files as a user you should not be editing. We have a mix of files you should edit, and files you SHOULD never edit, and files you should never need edit. The point of this PR is to build the framework to allow us to migrate/start hiding these files without breaking anything. And over time we will hide the rest of the json state files in the .homeassistant directory. Unhiding the homeassistant directory is for another discussion. |
|
The goal is fine. But in my experience when using a gui to browse the config directory, usually one has already set the file browser to show hidden files, to be able to see the config directory in the first place. So I'm not sure we'll reach the goal for that part of the user base that uses gui for browsing. For command line browsing this will have an effect. |
|
Depending on how you get there. Using something where you are input the path, it would, if you are showing all hidden files, you will still see them, but hopefully greyed out. It is a visual cue that these files are not be edited. |
| MAJOR_VERSION = 0 | ||
| MINOR_VERSION = 46 | ||
| PATCH_VERSION = '0.dev0' | ||
| PATCH_VERSION = '0.dev1' |
There was a problem hiding this comment.
Change was done so that people running dev would also get the update. Otherwise we would break anyone running dev. This prevents thats.
| CONFIG_DIR_NAME = '.homeassistant' | ||
| DATA_CUSTOMIZE = 'hass_customize' | ||
|
|
||
| FILE_MIGRATION = [ |
There was a problem hiding this comment.
Should this be a dict instead? Just fewer brackets.
There was a problem hiding this comment.
may change this in the future, more a fan of an array, since logically to me its not really a key value pair, but a list of tuples.
|
I like the idea of this framework. We're thinking about moving zwave files into their own subdirectory, and this would be really helpful to have. Some notes based on how we would use it there:
|
|
@armills that is the plan, this is step one on the framework, to allow renaming of files. long term all the zwave stuff would ideally be moved in .zwave (note the .) anything not commonly edited should be hidden. So there is a multitude of singles files to do first, then the moving support will be added in. |
…directory to be hidden, ios.conf used as the first one to undergo this change.
Description:
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass