Fix migrate_config to detect explicit [DEFAULT]s.

Review Request #2465 - Created July 11, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/1758
1758, 1798
8f90975...
Reviewers
pants-reviews
zundel
Previously it was using a public ConfigParser API and a private
ConfigParser data structure - both of which did not include the
'DEFAULT' section by design.

 migrations/options/src/python/migrate_config.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

I reproed the http://github.com/pantsbuild/pants/issues#issue/1758 case
with a local diff of:

diff --git a/pants.ini b/pants.ini
index 51aa086..5961063 100644
--- a/pants.ini
+++ b/pants.ini
@@ -9,6 +9,11 @@
 #   pants_workdir: the scratch space used to for live builds in this repo

 [DEFAULT]
+read_artifact_caches: ["/mnt/nfs/shared-cache/pants-artifact-cache", "https://foo.example.com/cache/"]
+read_from_artifact_cache: true
+write_artifact_caches: ["/mnt/nfs/shared-cache/pants-artifact-cache", "https://foo.example.com/cache/"]
+write_to_artifact_cache: true
+

This led to the following check results with the new code:

Checking config file at ./pants.ini for unmigrated keys.
Found write_to_artifact_cache in section [DEFAULT]. Should be write in section [cache].
Found read_from_artifact_cache in section [DEFAULT]. Should be read in section [cache].
Found read_artifact_caches in section [DEFAULT]. Should be read_from in section [cache].
Found write_artifact_caches in section [DEFAULT]. Should be write_to in section [cache].
Found jvm_options in section [DEFAULT]. Should be options in section [jvm].

The 1st 4 messages are what were expected, the last seems unexpected except
that the migration has been partially done, with the legacy option left in
place pending full code migration to jvm subsystem as commented in
pants.ini.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/70518341

John Sirois
Eric Ayers
Benjy Weinberger
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...