Commit Graph

28 Commits

Author SHA1 Message Date
Andreas Jaeger 22a7d65de8 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: Ia1bbe6bd173435674075bee595001a7e8aa0d4ec
2020-03-31 02:57:23 +00:00
Sean Dague 8a9057a4e2 Insert the right content at end of files
Previously the logic around hitting the end of the file without having
found the insertion point didn't account for the fact that you might
be in roughly the right area, and would not need to duplicate the meta
section or section headers.

This takes that into account during the else phase. It will help with
the neutron functional jobs that merge a lot of snippets together.

Change-Id: Ifaa1176e9fdfbc4fdb43192ed2f85e7306823848
2017-02-28 10:25:17 -05:00
Sean Dague c5626f3b4b support local.conf files with no [[local]] section yet
Previously if we tried to added content to a local.conf file without a
local section, we actually inserted that content in the wrong place at
the end of the file. This fixes that, with unit tests.

Change-Id: Ib886d78ce5f3718def784db59ba9abf41bdb0e7b
2017-02-27 10:08:48 -05:00
Mikhail S Medvedev ae73f278a1 add set_local_raw_multiline test
setlc_raw can be used to set several lines at once. The test checks that
it works as expected. See I565f5420743fbd95e9d744010c488953c54dd8a4
for some context of why that is useful.

Change-Id: I21bd78fa6169002a70fa9074d56d985bfc0b833f
2017-02-22 14:46:24 -06:00
Monty Taylor 375e772a6e
Match version entry in __init__ with setup.cfg
The name listed in setup.cfg is the key and needs to match what's in
__init__.py.

Change-Id: Icf0cfed5ed79bf5e96c94e81cf70f7769ff5b498
2017-02-15 13:43:55 -06:00
Sean Dague cf9093ec58 rename set_local_raw to set_local
set_local_raw is the new set_local, adjust the code to use the better
name.

Change-Id: I0f16ca647ada37049bdaf570b4695a73b60007ec
2017-02-10 17:01:42 -05:00
Sean Dague de46354ed3 new localrc set strategy
the localrc is really just executable shell, which means there are
tons of edgecases where you can't treat it the same as simple
assignment a=b.

Instead of trying to be smart about things and reduce duplication in
the localrc files, just do the naive thing and stack up all the shell
declarations in order. When evaluated in shell they will end up
stacking up as expected.

Change-Id: I231d130b24b02cdd79618f85472cee21905884e0
2017-02-10 16:57:34 -05:00
Sean Dague 1384ec992d add tests for merging lines beyond a=b
Change-Id: Id2af3b86e19c02fee4058d61e15eb6dd462c6e73
2017-01-19 09:18:11 -05:00
Sean Dague 20ab477eae add setlc_raw to the cli
This allows the devstack_localrc command from grenade be ported to
dsconf.

Change-Id: Iea8e826205ad402d0cf6fd6688860171b6f0a391
2017-01-19 09:11:14 -05:00
Sean Dague de7019bd28 fix pep8 issue
Change-Id: If81a2a22af406b700ec5b71b0e738e481a470ee0
2017-01-19 08:41:48 -05:00
Sean Dague 2c8054020b add the ability for raw line insert during merge
Some localrc stanzas, like enable/disable* need to come over during
merge. These lines will not have an = in them.
2017-01-17 15:57:40 -05:00
Sean Dague dae9f3be8d print when skipping merging lines 2017-01-17 11:03:13 -05:00
Sean Dague dde87e097f fix dsconf for setting localrc name=value
It's important when setting localrc name=value that there are no
spaces around the = sign, otherwise it doesn't work. Remember to treat
localrc special from the iniset portions.
2017-01-17 10:38:03 -05:00
Sean Dague 3ecd349bfe Fix merge of local.conf add tests 2017-01-17 09:22:18 -05:00
Sean Dague 0366529cc9 initial take at merging local.conf code 2017-01-17 09:03:50 -05:00
Sean Dague be8cb74021 add more cli support
Make it possible to create a blank local.conf
2017-01-17 08:31:49 -05:00
Sean Dague 36b1e0ff34 start adding parser, only support python3
python3 argparse adds native subparsers, which makes this much easier
to build without external dependencies (which improves load and run
time). 20ms for most operations means we can do 50 / sec. This will be
a slow down from the awk approach, but for larger gains in
readability.
2017-01-16 16:38:07 -05:00
Sean Dague 671f526e41 fix pep8 2017-01-16 15:41:20 -05:00
Sean Dague de574dc6a8 support localconf set 2017-01-16 14:20:58 -05:00
Sean Dague 925b1bc682 add functions to set items in local.conf 2017-01-16 13:31:53 -05:00
Sean Dague a0f574ab97 add localrc extraction 2017-01-16 12:45:37 -05:00
Sean Dague edd7cc1bcc tests for merging with existing ini files 2017-01-16 12:12:28 -05:00
Sean Dague e7636a7714 make iniset work with files that do not yet exist
This allows the add and set commands to work when files do not yet
exist, which becomes important for extracting things like post config
files.
2017-01-16 12:07:10 -05:00
Sean Dague 7e7ffec87e fix pep8 issue 2017-01-16 10:22:20 -05:00
Sean Dague 79f8f551c3 add uncomment function 2017-01-16 10:18:53 -05:00
Sean Dague 6971e39e94 Add comment, set, has methods 2017-01-16 10:04:51 -05:00
Sean Dague 0c14c58913 add inifile add/remove code 2017-01-16 09:37:39 -05:00
Sean Dague 7955f99443 Initial Cookiecutter Commit. 2017-01-16 08:06:54 -05:00