Fixup migrate_config to use new Config API.

Review Request #1514 - Created Dec. 18, 2014 and submitted

Information
John Sirois
pants
jsirois/migrate_config/fix
876
ad0e9ff...
Reviewers
pants-reviews
benjyw, zundel

When support for multiple config files was added
migrate_config broke accessing a no-longer available
`Config.configparser` field.

src/python/pants/option/migrate_config.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Found the tool broken when trying to migrate twitter/commons (https://rbcommons.com/s/twitter/r/1513/):

$ pants.dev binary src/python/pants/option:migrate_config
$ ./dist/migrate_config.pex ~/dev-jsirois-commons/pants.ini 
Checking config file at /home/jsirois/dev-jsirois-commons/pants.ini for unmigrated keys.
Traceback (most recent call last):
  File "/home/jsirois/dev/3rdparty/pants/dist/migrate_config.pex/.bootstrap/_pex/pex.py", line 272, in execute
    self.execute_entry(entry_point, args)
  File "/home/jsirois/dev/3rdparty/pants/dist/migrate_config.pex/.bootstrap/_pex/pex.py", line 320, in execute_entry
    runner(entry_point)
  File "/home/jsirois/dev/3rdparty/pants/dist/migrate_config.pex/.bootstrap/_pex/pex.py", line 337, in execute_module
    runpy.run_module(module_name, run_name='__main__')
  File "/usr/lib/python2.7/runpy.py", line 180, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "pants/option/migrate_config.py", line 112, in <module>
  File "pants/option/migrate_config.py", line 72, in check_config_file
AttributeError: 'ChainedConfig' object has no attribute 'configparser'

After this fix I was able to run the tool and migrate twitter/commons:

$ pants.dev binary src/python/pants/option:migrate_config
$ ./dist/migrate_config.pex ~/dev-jsirois-commons/pants.ini 
Checking config file at /home/jsirois/dev-jsirois-commons/pants.ini for unmigrated keys.
Found jvm_args in section [junit-run]. Should be jvm_options in section [test.junit].
Found no_warning_args in section [java-compile]. Should be no_warning_args in section [compile.java].
Found jvm_args in section [scala-repl]. Should be jvm_options in section [repl.scala].
Found bootstrap-tools in section [checkstyle]. Should be bootstrap_tools in section [compile.checkstyle].
Found configuration in section [checkstyle]. Should be configuration in section [compile.checkstyle].
Found warning_args in section [java-compile]. Should be warning_args in section [compile.java].
Found javac_args in section [java-compile]. Should be args in section [compile.java].
  Note: source and target args should be moved to separate source: and target: options. Other args should be placed in args: and prefixed with -C.
Found partition_size_hint in section [java-compile]. Should be partition_size_hint in section [compile.java].
Found properties in section [checkstyle]. Should be properties in section [compile.checkstyle].

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

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

Status: Closed (submitted)

Loading...