salt icon indicating copy to clipboard operation
salt copied to clipboard

- '__reqs__' is an invalid keyword argument for 'service.mod_watch'.

Open gerardjp opened this issue 12 years ago • 9 comments

Hi All,

Is see this message when applying a single state, but not all the time. Seems it's related to a template (file) being updated.


    warnings:
        - '__reqs__' is an invalid keyword argument for 'service.mod_watch'. If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs. Your approach will work until Salt Lithium is out. Please update your state files.

I love the idea to be able to use variables in jinja templates without the need to address them in the managed file directive in my SLS files.

Is Salt moving to or away from the context key,value dict concept in the SLS file?

If this is a bug and there's anything else I need to provide please let me know.

Regards,

Gerard.

gerardjp avatar Oct 17 '14 09:10 gerardjp

Hi @gerardjp. Thanks for this report. Could you provide us with a simple test case that produces this error for you? I'd like to have some context around what you're trying to do. Thanks!

cachedout avatar Oct 17 '14 16:10 cachedout

Hi @cachedout,

I originally saw it on another code part, but just bumped into it again. As far as I can tell it occurs when a service definition fails to start.

The definition:

mysql-service:
  service:
    - running
    - name: mysql
    - watch:
      - file: /etc/mysql/my.cnf

The error:

    service_|-mysql-service_|-mysql_|-running:
        ----------
        __run_num__:
            12
        changes:
            ----------
            mysql:
                False
        comment:
            Failed to start the service
        duration:
            41.667
        name:
            mysql
        result:
            False
        start_time:
            19:56:19.273740
        warnings:
            - '__reqs__' is an invalid keyword argument for 'service.mod_watch'. If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs. Your approach will work until Salt Lithium is out. Please update your state files.

The reason being, the mysql-server package installation failed.Thus no service available yet to start. I'll progress until it does run error free, and post my findings from the state before last. If that helps.

Maybe similar: https://groups.google.com/forum/#!topic/salt-users/0cNe6NAnYW4

Kind regards,

Gerard.

gerardjp avatar Oct 18 '14 08:10 gerardjp

Came across another one (this time with RC4 for v2014.7.0). When files change (and thus the service definition is hit) the messages appears. Running it again directly after show no errors.

'__reqs__' is an invalid keyword argument for 'service.mod_watch'. If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs. Your approach will work until Salt Lithium is out. Please update your state files.
nagios3:
  service:
    - running
    - watch:
      - file: /etc/nagios3/*
      - file: /etc/nagios3/conf.d/*

The message part: If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs. suggests that passing key,value pairs from a sls to a ninja template will become mandatory in the future.

Does that mean that solely using this in a jinja template is not possible anymore?

{% for name, parms in pillar['pkg']['nagios-server']['server_checks_list'].iteritems() -%}

Thanx a lot!!

If there's anything you want me to check please let me know.

Regards,

Gerard.

gerardjp avatar Oct 22 '14 11:10 gerardjp

This is really helpful! Thanks! We should be able to get this figured out.

cachedout avatar Oct 22 '14 21:10 cachedout

Also additionally found with the following example:

top.sls base: lcminion: - nginx

nginx/init.sls nginx_install: pkg.installed: - name: nginx - failhard: True

nginx_service: service.running: - name: nginx - require: - pkg: nginx_install - watch: - file: nginx_conf

nginx_conf: file: - managed - source: salt://nginx/nginx.confa - name: /etc/nginx/nginx.conf - user: root - group: root - mode: 644 - makedirs: True

command [root@dgm-cent66 salt]# salt lcminion state.highstate --out=json test=True { "lcminion": { "pkg_|-nginx_install_|-nginx_|-installed": { "comment": "Package nginx is already installed.", "name": "nginx", "start_time": "15:39:41.692742", "result": true, "duration": 727.49699999999996, "run_num": 0, "changes": {} }, "file_|-nginx_conf_|-/etc/nginx/nginx.conf_|-managed": { "comment": "The file /etc/nginx/nginx.conf is set to be changed", "name": "/etc/nginx/nginx.conf", "start_time": "15:39:42.420904", "result": null, "duration": 1.9299999999999999, "run_num": 1, "changes": [ false, "Source file salt://nginx/nginx.confa not found" ] }, "service_|-nginx_service_|-nginx_|-running": { "comment": "Service is set to be restarted", "name": "nginx", "warnings": [ "'reqs' is an invalid keyword argument for 'service.mod_watch'. If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs. Your approach will work until Salt Lithium is out. Please update your state files." ], "start_time": "15:39:42.440481", "result": null, "duration": 22.195, "run_num": 3, "changes": {} } } } [root@dgm-cent66 salt]#

Adding '- enable: True' to nginx_service will also include 'enable' to the reqs message, if that helps

dmurphy18 avatar Mar 13 '15 21:03 dmurphy18

We faced the same issue in 2014.7.1. It could be easily fixed by back porting https://github.com/saltstack/salt/pull/18846.

vakulich avatar Apr 10 '15 11:04 vakulich

@vakulich Good call. I've backported #18846 to the 2014.7 branch in #22532.

Can anyone give that patch a try and confirm that this is fixed?

rallytime avatar Apr 10 '15 15:04 rallytime

I actually applied this patch and it worked out well.

vakulich avatar Apr 13 '15 06:04 vakulich

Great! Thanks for testing that out. As such, I am going to close out this issue. Thanks!

rallytime avatar Apr 13 '15 14:04 rallytime