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

More than 2 json outputs for sophomorix #102

Open
kiarn opened this issue May 22, 2019 · 1 comment
Open

More than 2 json outputs for sophomorix #102

kiarn opened this issue May 22, 2019 · 1 comment

Comments

@kiarn
Copy link
Member

kiarn commented May 22, 2019

Hello @PLanB2008

Related to your comment here

# TODO: Fifure out why return message changed
: some sophomorix commands return 2 json outputs.

I already wrote a post about it here : linuxmuster/sophomorix4#68 (comment)

There was a major change in lmn_getSophomorixValue ( here :

def lmn_getSophomorixValue(sophomorixCommand, jsonpath, ignoreErrors=False):
) , because I saw some conflicts in the output from sophomorix commands ( when run simultaneously ), and this is not handled with threads ( it's a little faster ).

I had to choose between merging the output dicts, or simply taking one.
I saw that the first one always contain the main informations, that's why I took the first one.

Ideally, it would be great if sophomorix only delivers one json output.

@kiarn
Copy link
Member Author

kiarn commented Jul 24, 2019

So I have another example, when an admin wants to set passwords for many teachers :

sophomorix-passwd -u t1,t2,t3 --pass Muster! -jj

The stderr is :

# JSON-begin
{"FINAL_STEP":"3","JSONINFO":"PROGRESS","STEP":"1","COMMENT_DE":"Aktualisiere Benutzer cssc.","COMMENT_EN":"Updating user cssc."}
# JSON-end
# JSON-begin
{"STEP":"2","COMMENT_EN":"Updating user dr.","COMMENT_DE":"Aktualisiere Benutzer dr.","JSONINFO":"PROGRESS","FINAL_STEP":"3"}
# JSON-end
# JSON-begin
{"FINAL_STEP":"3","JSONINFO":"PROGRESS","COMMENT_DE":"Aktualisiere Benutzer t1.","COMMENT_EN":"Updating user t1.","STEP":"3"}
# JSON-end
# JSON-begin
{"JSONCOMMENT":"---","SCRIPTNAME":"sophomorix-passwd","JSONINFO":"RESULT","OUTPUT":[{"LOG":"/usr/sbin/sophomorix-passwd terminated regularly","TYPE":"LOG"}]}
# JSON-end

lmn_getSophomorixValue() only gets the first dict. Merging all the result dicts is a risky way, it would be better to ask @jeffbeck if it's possible to do it in sophomorix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant