-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I started a branch in order to create more objects to make using the library easier.
The plan is to separate out the backends and servers into objects that can be controlled and queried indepently using object methods. I just wanted to share what I will be doing in case you had different design goals or additional input. So for example.
instance.backends.first.servers # returns a list of servers in the backend
instance.backends.first.name # backend name
instance.backends.first.stats # returns stats
instance.backends.first.downtime # returns downtime statinstance.servers.first.name # returns the server name/id
instance.servers.first.stats # returns the stats of the server
instance.servers.first.downtime # returns the downtime stat
instance.servers.first.backends # returns the backends the server belongs to
instance.servers.first.disable(backend='all') # disables the server for the backend(s)I plan to use method_missing to create dynamic methods for stats so that each object appears to have implemented a method to return a paticular stat. This will be in the server and backend object.
example:
def method_missing(method, *args, &block)
if not stats.has_key?(method.to_s)
raise NoMethodError
else
stats[method.to_s]
end
endhttps://github.com/logicminds/haproxy_manager/blob/backend_class/lib/haproxy_manager
Metadata
Metadata
Assignees
Labels
No labels