Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit status for kamcmd #211

Closed
AlessioCasco opened this issue Jun 16, 2015 · 3 comments
Closed

Exit status for kamcmd #211

AlessioCasco opened this issue Jun 16, 2015 · 3 comments

Comments

@AlessioCasco
Copy link
Contributor

Hello

I'm running Kamailio version: 4.2.5 (x86_64/linux).
kamcmd is always exiting with exit status "0" even if the command failed.

root@lb:# kamcmd willfail
error: 500 - command willfail not found
root@lb:
# echo $?
0

[live] root@lb32:# kamcmd permissions.trustedReload
Reload OK
root@lb:
# echo $?
0

@miconda
Copy link
Member

miconda commented Jun 16, 2015

I think it is a relative point of view to be considered.

kamcmd itself didn't fail, because it is a tool to take the command line parameters and send a command to kamailio. Then it prints the output from kamailio. In that respect, kamcmd was successful.

I just tested with curl tool and if I request a page that doesn't exits on a web site, its return code is also 0.

Making kamcmd aware of the meaning of the response from kamailio might add complexity and duplicate lot of context, which can become hard to maintain.

I let the discussion here open for other opinions, to see what would be preferred to be done. I consider to be normal behaviour right now.

@AlessioCasco
Copy link
Contributor Author

I agree with you, my only concern is related to the fact that scripting kamcmd (on puppet for example), will end up in the case where you won't know if the command was successful or not.

A solution would be to use the stdout, and do some logic on top of that.

@miconda
Copy link
Member

miconda commented Jun 19, 2015

You can use jsonrpc or xmlrpc for more standard formatted output. It should be easier to parse the result returned by kamailio.

Look at kamcli (https://github.com/asipto/kamcli) -- it can send jsonrpc commands via a local fifo file, if you prefer to avoid network communication.

I will close this as not being an issue. Eventually you can start a discussion on sr-dev mailing list for enhancing kamcmd in being more flexible in such situations.

@miconda miconda closed this as completed Jun 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants