[openstack-dev] [kolla] why common_options type is dictionary ?

Margin Hu today.good at 163.com
Tue Jul 11 09:59:23 UTC 2017


If I modify kolla_docker.py , how to debug an ansible module ?

I find 
http://docs.ansible.com/ansible/dev_guide/developing_modules.html, but  
failed to run it as following.

how do you do testing when  develop the module ?

[root at server120 ansible-module]# ansible/hacking/test-module  -m 
./kolla_docker.py
* including generated source, if any, saving to: 
/root/.ansible_module_generated
* ansiballz module detected; extracted module source to: /root/debug_dir
***********************************
RAW OUTPUT

{"msg": "missing required arguments: action", "failed": true, 
"invocation": {"module_args": {"cap_add": [], "graceful_timeout": 10, 
"common_options": {}, "labels": {}, "remove_on_exit": true, 
"tls_verify": false, "restart_retries": 10, "detach": true, 
"security_opt": [], "privileged": false, "api_version": "auto"}}}


***********************************
PARSED OUTPUT
{
     "failed": true,
     "invocation": {
         "module_args": {
             "api_version": "auto",
             "cap_add": [],
             "common_options": {},
             "detach": true,
             "graceful_timeout": 10,
             "labels": {},
             "privileged": false,
             "remove_on_exit": true,
             "restart_retries": 10,
             "security_opt": [],
             "tls_verify": false
         }
     },
     "msg": "missing required arguments: action"
}

On 7/11 17:50, Margin Hu wrote:
>
> Ok, I see.
>
> I wanted to add "--ulimit " parameter when docker run ,  It seems that 
> I have to add an extra parameter for kolla_docker module in 
> kolla_docker.py.
>
>
> On 7/11 17:08, Jeffrey Zhang wrote:
>> there are lots of non-plain variables in kolla, dict or list in Ansible.
>>
>> if you do not want to override the dict, you can add following into 
>> globals.yml file.
>>
>> docker_common_options:
>>     auth_email: "{{ docker_registry_email }}"
>>     auth_password: "{{ docker_registry_password }}"
>>     auth_registry: "{{ docker_registry }}"
>>     auth_username: "{{ docker_registry_username }}"
>>     environment:
>>       KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
>>       custom_key: custom value
>>     restart_policy: "{{ docker_restart_policy }}"
>>     restart_retries: "{{ docker_restart_policy_retry }}"
>>
>>
>> On Tue, Jul 11, 2017 at 4:55 PM, Paul Bourke <paul.bourke at oracle.com 
>> <mailto:paul.bourke at oracle.com>> wrote:
>>
>>     Because its a series of key value pairs:
>>     https://github.com/openstack/kolla-ansible/blob/master/ansible/group_vars/all.yml#L96-L105
>>     <https://github.com/openstack/kolla-ansible/blob/master/ansible/group_vars/all.yml#L96-L105>
>>
>>     Is there another type you feel would fit better?
>>
>>
>>     On 11/07/17 05:22, Margin Hu wrote:
>>
>>         Hi Guys:
>>
>>         I want to set docker_common_options parameter but find its
>>         type is dictionary.  why?
>>
>>         ansible/roles/zun/tasks/pull.yml:5: common_options: "{{
>>         docker_common_options }}"
>>         tests/test_kolla_docker.py:44:
>>         common_options=dict(required=False, type='dict', default=dict()),
>>
>>
>>
>>
>>         __________________________________________________________________________
>>         OpenStack Development Mailing List (not for usage questions)
>>         Unsubscribe:
>>         OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>>         <http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>>         http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>         <http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev>
>>
>>
>>     __________________________________________________________________________
>>     OpenStack Development Mailing List (not for usage questions)
>>     Unsubscribe:
>>     OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>>     <http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>>     http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>     <http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev>
>>
>>
>>
>>
>> -- 
>> Regards,
>> Jeffrey Zhang
>> Blog: http://xcodest.me <http://xcodest.me/>
>>
>>
>> __________________________________________________________________________
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe:OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170711/21d2e6ca/attachment.html>


More information about the OpenStack-dev mailing list