lhupfeldt / multiconf Goto Github PK
View Code? Open in Web Editor NEWPython module for data holder objects with multiple environment specific values for a single property
License: BSD 3-Clause "New" or "Revised" License
Python module for data holder objects with multiple environment specific values for a single property
License: BSD 3-Clause "New" or "Revised" License
Downloading/unpacking multiconf
Getting page https://pypi.python.org/simple/multiconf/
Could not fetch URL https://pypi.python.org/simple/multiconf/: HTTP Error 404: Not Found
Will skip URL https://pypi.python.org/simple/multiconf/ when looking for download links for multiconf
Getting page https://pypi.python.org/simple/
URLs to search for versions for multiconf:
In a ConfigBuilder I want to access a proeprty of a parent object, but it fails and only returns me a unfrozen AttributeCollector
The usecase is a serverBuilder where the hostname_patterns is set to "%(domain).%(env).%(project).example.net" and I want to so the expansion when building the Server object, however I cannot lookup the domain name defined in parent object
I could do the conversion lazily in the server ConfigItem but that would mean lazily validating the generated name against know hosts.
The readme text contains a few typos, e.g. "Multionf" in one sentence. Beside that, the term J2EE is quite old-fashioned and should ideally be changed to Java EE some time;-)
In a common pattern we use
class Domain(ConfigItem):
def __init__(self, name, base_port, java_home, domain_user_override=None, **kwargs):
super(Domain, self).__init__(name=name, base_port=base_port, java_home=java_home, domain_user_override=domain_user_override, **kwargs)
@property
def user(self):
if self.domain_user_override
return self.domain_user_override
return calculated_user
However when I attempt to use the override as such
with Domain(name='eui', base_port=9000, java_home='/opt/java/jdk1.6.0_17',file_encoding="UTF-8") as eui_domain:
eui_domain.domain_user_override(devLocal="myname")
I get the following error:
ConfigError: Found different types of property 'domain_user_override' for different envs: <type 'str'> previously found types: [<type 'NoneType'>]
Issue with parent:
We need set of navigation methods that provide specific str values of the parent at one or more levels above the current node,
e.g.
iDomainXYZ->Cluster123->Server1
contained_in("Domain") returns "DomainXYZ"
contained_in("Cluster") returns "Cluster123"
contained_in("Server") returns "Server1"
Please provide the slides from DemoCamp CPH either here or in another appropriate place (linking from this Wiki) ideally by Dec 27, when Vienna Code Kitchen with PyUGAT participation hopes to have a look at this project and Kokki, maybe do some "cooking";-)
The use case of "I need to do X if there are some of Y defined" is not cleanly handled, as empty collections are treated as errors (missing property).
Example:
I have a template that needs to write a xml fragment per data source if there are datasources. The current template resembles
Above code raises a exception when no datasources are defined for a domain (domain has no property 'datasources')
I need to wrap the above in a block testing for "hasattr(domain, 'datasources') in order to get the code to work.
I don't think that is very clean, as it adds alot of boiler plate code. It would be better if the "domain" config item, could let multiconf know that datasources is a valid property and should return a empty collection unless otherwise defined but I cannot find that functionality
Hi,
I need to create a pipeline, where some jobs within parallel execution do not need to be checked if they are successful or not. I can't seem to find a way to put that into a flow.
Please help!
Aleksey
Hi,
It seems the circle.yml configuration was not used for some time. CircleCI will switch off version 1, so the file is going to be completely useless in a few months.
Assume the following setup
envs = dev_local dev, test,pp,prod
group "g_dev" = dev + dev_local
and the following code:
With MyConfig(url='http://www.example.com/live') as server:
serversh.url (g_dev="http://www.example.com/test", dev_local="http://www.example.com/local'")
I get an error:
ConfigError: A value is already specified for: Env('dev_local') from group EnvGroup('g_dev') {
Env('dev'),
Env('dev_local')
Assume the following classes
Domain(ConfigItem)
WeblogicDomain(Domain)
JbossDomain(Domain)
ObpmDomain(Domain)
If I set a "nested_repeatable" on the Domain class e.g. "serves, datasources" I currently need to repeat that decorator on all subclasses.
I suggest that such decorators are inherited, and if the decorator is on the subclass the values are merged not overwritten. in the case of nested_repeatable Domain could have "servers, datasources" and JbossDomain could have "directories" resulting in a effective nested_repeatable of "serves, datasources, directories"
getattr(multconf_object, 'non-existing-property', 'default')
fails with ConfigException
should fail with AttributeError - once the multiconf object is frozen.
Since some properties depend on their parent objects in order to calculate their final value, they cannot be fully validated before finalization since the parent values are not available before then. This is also described in #7
ConfigItems should support a method for validation after finalization, so that waiting for property access to perform the validation lazily is avoided.
If a child configItem is repeatable, the parent should always return a collection even if only one child object is defined.
With only one logging appender defined I get the following exception when doing this in a template
File "/home/henrik/Temp/adlt/deployment2/cookbooks/jboss/templates/jboss-eap-5.1.2/server/default/conf/jboss-log4j.xml.template", line 8, in
TypeError: 'FileAppender' object is not iterable
Hi,
I think that Multiconf could be used as state holder for Salt (http://saltstack.org), but what is required is a Salt renderer, which will translate Multiconf to structure understood by Salt (http://docs.saltstack.com/topics/tutorials/starting_states.html#understanding-the-render-system)
Any thoughts?
Aleksey
When working with large configurations, it would be helpfull to be able to explore the loaded config via tools like ipython. The ipython shell does tab completion of attributes and object methods, based on what is returned by dir()
. By adding multiconf attributes and property methods to output of dir()
it would greatly help when using such tools.
The hidden root reference in ConfigItem should be exposed
It should be possible to define groups that overlap e.g. I can have
dev_group for all that it connected to dev env (dev, dev_local)
single_vm_group for all envs which on has a single vm (dev,dev_local,test,edu)
When working with large configurations it is sometimes neceseary to search for a value, and the finding the corresponding places in the model where it is created.
To fascilitate simple grep
'ing, it would be great if dump object had an option to print fully qualified keys.
E.g. conceptually:
'project.name': 'foo',
'project.server.name': 'bar-server'
'project.server.port': '8888'
``
As a programmer using multiconfi, I would like to supply the parameters to the @required decorator as a list, not as a string with commas in.
This would be help readability when there are many @required parameters. It would also be nice to have it on other decorators, e.g. @nested_repeatables.
Thanks
Andy Watkins
The "hidden" parent reference in ConfigItem should be exposed.
it should be possible to do something like
print c.jbossDomain['obpm'].
When working with large configurations, the error dump is so long that it makes it hard to find the actual problem.
I think it would be sufficient if the error dump only displayed the object attributes at the level the error occurred (i.e. did not dump child objects).
Assume the following setup
envs = dev_local dev, test,pp,prod
and the following code:
With MyConfig(url='http://www.example.com/live') as server:
server.url (dev="http://www.example.com/test",
server.url.(dev_local="http://www.example.com/local'")
I get an error: "ConfigError: Redefined attribute", but the program continues.
however when I in the build() method tries to access a property (not the same as above) I do not get the value but instead
AttributeCollector: 'num_servers':frozen, values: {Env('devLocal'): 1, Env('prod'): 4, Env('tst'): 1, Env('dev'): 1, Env('pp'): 1}
init can get very long if all property default values must be set in that method, suggest allowing code like this
With MyObject() as obj:
obj.property(all=value)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.