-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pythonpaste: new lens for Python Paste configs.
Added a new lense file for Python Paste configs. This is useful for editing a variety of Openstack config files including, Nova api-paste.ini, Glance *.ini files, keystone.conf, and the swift config files.
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ Contributions by: | |
Joel Nimety <[email protected]> | ||
Matt Palmer <[email protected]> | ||
Bill Pemberton <[email protected]> | ||
Dan Prince <[email protected]> | ||
Alan Pevec <[email protected]> | ||
Brett Porter <[email protected]> | ||
Robin Lee Powell <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
(* Python paste config file lens for Augeas | ||
Author: Dan Prince <[email protected]> | ||
*) | ||
module PythonPaste = | ||
autoload xfm | ||
|
||
(************************************************************************ | ||
* INI File settings | ||
*************************************************************************) | ||
|
||
let comment = IniFile.comment "#" "#" | ||
|
||
let sep = IniFile.sep "=" "=" | ||
|
||
let eol = Util.eol | ||
|
||
(************************************************************************ | ||
* ENTRY | ||
*************************************************************************) | ||
|
||
let url_entry = /\/[\/A-Za-z0-9.-_]* ?[:|=] [A-Za-z0-9.-_]+/ | ||
|
||
let no_inline_comment_entry (kw:regexp) (sep:lens) (comment:lens) | ||
= [ key kw . sep . IniFile.sto_to_eol? . eol ] | ||
| comment | ||
| [ seq "urls" . store url_entry . eol ] | ||
|
||
let entry_re = ( /[A-Za-z][:#A-Za-z0-9._-]+/ ) | ||
|
||
let entry = no_inline_comment_entry entry_re sep comment | ||
|
||
(************************************************************************ | ||
* RECORD | ||
*************************************************************************) | ||
|
||
let title = IniFile.title IniFile.record_re | ||
|
||
let record = IniFile.record title entry | ||
|
||
(************************************************************************ | ||
* LENS & FILTER | ||
*************************************************************************) | ||
let lns = IniFile.lns record comment | ||
|
||
let filter = ((incl "/etc/glance/*.ini") | ||
. (incl "/etc/keystone/keystone.conf") | ||
. (incl "/etc/nova/api-paste.ini") | ||
. (incl "/etc/swift/swift.conf") | ||
. (incl "/etc/swift/proxy-server.conf") | ||
. (incl "/etc/swift/account-server/*.conf") | ||
. (incl "/etc/swift/container-server/*.conf") | ||
. (incl "/etc/swift/object-server/*.conf")) | ||
|
||
let xfm = transform lns filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module Test_pythonpaste = | ||
|
||
let conf = " | ||
#blah blah | ||
[main] | ||
pipeline = hello | ||
|
||
[composite:main] | ||
use = egg:Paste#urlmap | ||
/v2.0 = public_api | ||
/: public_version_api | ||
" | ||
|
||
test PythonPaste.lns get conf = | ||
{ } | ||
{ "#comment" = "blah blah" } | ||
{ "main" | ||
{ "pipeline" = "hello" } | ||
{ } | ||
} | ||
{ "composite:main" | ||
{ "use" = "egg:Paste#urlmap" } | ||
{ "1" = "/v2.0 = public_api" } | ||
{ "2" = "/: public_version_api" } | ||
} | ||
|
||
|
||
test PythonPaste.lns put conf after | ||
set "main/pipeline" "goodbye"; | ||
set "composite:main/3" "/v3: a_new_api_version" | ||
= " | ||
#blah blah | ||
[main] | ||
pipeline = goodbye | ||
|
||
[composite:main] | ||
use = egg:Paste#urlmap | ||
/v2.0 = public_api | ||
/: public_version_api | ||
/v3: a_new_api_version | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters