Job scheduler syntax question

I am having some difficulty setting up a simple job. I found an example for setting up the “ec2x.sms_format_config” as a scheduled job, but I am not sure what I’m doing wrong when adding parameter of ‘value=1’. If I add it in the ‘arg’ box like below, I get an error:

image

File “/var/cache/salt/minion/extmods/modules/ec2x.py”, line 887, in sms_format_config
return query(“AT+CMGF={:d}”.format(value))

If I try ec2x.sms_format_config value=1 in the Function box, I get this following error continously:

2020-01-30 22:15:32,015 [salt.utils.schedule:1031][INFO ][390] Invalid function: ec2x.sms_format_config 1 in scheduled job SMS Format.

I have tried several combinations with single quotes, double quotes, value=‘1’, just 1, etc., but Nothing has worked for me. Can someone please guide me what I am doing wrong? I am totally new to this, and this is my first post.

Thank You!

Zia

Hi Zia

I think you just need to remove the single quotes, and move the argument from args to kwargs.
The kwargs field should have one line and look like this.

value=1

Then it should work :slight_smile:

Best regards
/Malte

@Malte Thank you. I tried moving it kwargs without quotes, but it still gives me the Unknown format error:


2020-01-31 11:29:41,590 [salt.utils.schedule:927 ][ERROR ][1390] Unhandled exception running ec2x.sms_format_config
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/salt/utils/schedule.py”, line 894, in handle_func
ret[‘return’] = self.functions[func](*args, **kwargs)
File “/var/cache/salt/minion/extmods/modules/ec2x.py”, line 887, in sms_format_config
return query(“AT+CMGF={:d}”.format(value))
ValueError: Unknown format code ‘d’ for object of type ‘str’


I get the same error if I move it back to args, without the quotes, I get the exact same error as above. Do you have any other suggestions?

Thanks

Zia

I was never able to get ec2x.sms_format_config function to work as a job. I ended up using ec2x.query ‘at+cmgf=1’. Something might be wrong with the sms_format_config function.

image

This topic was automatically closed 33 days after the last reply. New replies are no longer allowed.