Re: [PATCH] get_method_args() Update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



makkalot@xxxxxxxxx wrote:
Hi ML, after we talked about my previous patch with mpdehaan we decided to change it and make it more beatiful:) . I added a get_method_args() to code base that method doesnt break the current code base. It is useful when other applications like funcweb want to have the method's argument, therefore if a user wants its module to be reachable from funcweb he/she needs to override register_method_args in the module and fill it according to rules we decided.
If the patch is accepted i will add them to wiki ;)

You can get my branch as same as kadamski explained, I copy and paste here again :)

You can see the code online:
http://github.com/makkalot/func/commits/makkalot_extreme

Or import my branch to your func git tree:
 git remote add makkalot git://github.com/makkalot/func.git
 git fetch makkalot
 git checkout -b makkalot_extreme makkalot/makkalot_extreme
[make/install/test and when you are done you can remove it:]
 git branch -D makkalot_extreme

Or just clone it from github:
 git clone git://github.com/makkalot/func.git

I have a diff if iyou dont want to do all the stuff :)
http://tutorials-place.com/media/makkalot_stuff/get_method_arg.patch

------------------------------------------------------------------------------------------------------------------------------------------------------
And here is an example how to use it :

In [1]: from func.overlord.client import Overlord

In [2]: fc = Overlord("acervirtual.evlan.com")

In [6]: fc.service.get_method_args()
Out[6]:
{'acervirtual.evlan.com': {'get_enabled': {},
                           'get_running': {},
                           'inventory': {},
'reload': {'service_name': {'description': 'The name of the running services',
                                                       'type': 'string',
                                                       'validator': '^[a-z]+$'}},
'restart': {'service_name': {'description': 'The name of the running services',
                                                        'type': 'string',
                                                        'validator': '^[a-z]+$'}},
'start': {'service_name': {'description': 'The name of the running services',
                                                      'type': 'string',
                                                      'validator': '^[a-z]+$'}},
'status': {'service_name': {'description': 'The name of the running services',
                                                       'type': 'string',
                                                       'validator': '^[a-z]+$'}},
'stop': {'service_name': {'description': 'The name of the running services',
                                                     'type': 'string',
                                                     'validator': '^[a-z]+$'}}}}

In [7]: fc.iptables.get_method_args()
Out[7]: {'acervirtual.evlan.com': {}}


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

This looks like a reasonable syntax, though do I have anything to test it with?

The next step is probably to teach FuncWeb about how to render out basic fields against these things.

How do you plan on enforcing "validator"? I can see the others being a simple display hint, or some basic javascript validation in the web app. Is there server side validation applied ahead of the actual method calls?

The other thing to do would be (once we have a proof of concept working for at least one or two of the modules, would be to add this get_method_args information to the other modules... though we probably want to make sure we
are good with the implementation first.

Let me know when there's something I can test and play with further and I'll take a look, or if I can provide further info.

Thanks!

--Michael


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux