-
-
Notifications
You must be signed in to change notification settings - Fork 740
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
Better stdout support #1052
Comments
I believe all the runners (local, remote and python) should return a full output unless the script / action being executed does some weird buffering. There are some cases where we manipulate the output and this might be where the problem lies. If you can share the action (and the expected output) where you encountered this problem I can have a look and try to reproduce it. On a related note, I believe there is a known limitation with a remote runner with an action which uses sudo (stdout and stderr are combined):
|
@Kami Sorry, I should have been more clear. It's not so much that the output is cut off, it's that it's squeezed inside a fixed-sized box:
|
@jtopjian Ah, thanks. That's actually just the user-friendly formatting which is enabled in the CLI by default. You can retrieve the raw response as returned by the API by passing For example: st2 run -j core.local cmd=date I recently just added some documentation for the CLI, but it doesn't include the section about retrieving raw output - I will update it today and make sure it also includes section about the output formatting :) |
@Kami Yup, I saw the
|
@jtopjian This is looks fine though, right? Or am I missing something? Printing |
@Kami Here's the output I'd like to see, without anything else printed from
It's not that these commands return their own table-formated data -- this can apply to a myriad of other cases (a list of users, for example) where I just want the raw, unobstructed output of the runner. Does that make sense? |
I see @jtopjian's case as being a common use case as users bring in existing scripts, with their own existing formatting and whatnot. In order to smooth the transition, we need to have a command that a user can run a remote- or local- runner and have the behavior be the exact same until such time as they're able to go into these scripts and adapt them to being parsed by StackStorm. So, the command I don't know where in the model this fits (parameter of metadata, a flag at runtime, ENV vars... whatever), but I see the use being important in the first scenario where users will only want to audit and collect history of commands already being run to gain confidence in the system. |
@jfryman That's an interesting view. It sounds to me like I'm shoe-horning some existing scripts into st2? If that's the case, what would be the proper long-term way of modifying our existing reporting tools into st2? Or are these types of tools not suited for st2? IMO, by not having an easy way to bundle these types of tools into st2 (not just for an initial conversion, but for long-term use), then st2 is checking off every box except one: the need for sysadmins/operators to run frequent/common queries against their environment. These tools would then need housed under a separate repo or other aggregation command. |
@jtopjian I'm not sure that you're shoe-horning, so to say. One of our major goals is to allow users to import their existing scripts and be useful. So, if you import a script with all intentions to use it with StackStorm, and it doesn't behave in the same manner as it did before (except with all the StackStorm trimmings - audit, history, RBAC (:soon:)), then it could hurt adoption. Our goal however as users become more familiar with the system is to rip out any view logic, or logging logic, or any of the other things that come for free with StackStorm from scripts, and rely on our 'common currency', which is JSON to pass data around, and workflows to ultimately decide how and where output should be sent. Scripts should eventually be broken down into the smallest unit possible to decrease maintenance costs, and then any output (including shell commands) can be output as JSON, parsed by our libraries, and easily passed around as actual objects instead of the long commands that usually require a large dose of So, again... not so much shoe-horning as it is a transition path. As your scripts become simpler, you'll see this need become less and less. But, we still need a path for you (and others) to get from A->Z. @jtopjian Certainly open to input you have on how you'd use this for your own use case. |
@jfryman OK, I think I'm starting to understand. So, let's say st2 was totally complete, then any type of action that I implement in st2 should ideally return a json result? Then depending on where the action was called (command-line, web ui, etc), the result would be formatted appropriately? |
@Kami ah, nice! Now if this was available under |
@jtopjian Agreed - that's something @jfryman and I have just talked about on slack. @manasdk IIRC, you added support for -k and other flags to I'm also just working on the documentation for output formatting and execution get flags right now, but this will need to be updated when we also add those flags to run command. |
LOL. TIL @jtopjian just to close the loop though. JSON is automatically parsed at each layer into an object for easier manipulation. Output formatting like |
It looks like we got this resolved so I will close the ticket. @jtopjian We will keep you posted on the progress of adding |
Hello. How I can improve formatting of chatops messages (slack/mattermost), if I get:
It seems that stdout cannot be formatted well. It's unreadable. |
@livelace As described in Slack, behind the scenes st2 action: st2 run linux.traceroute host=google.com Executes the following script:
The problem was in original By design StackStorm shows what he get from the script via stdout, stderr and exit code. Anyways, here is a small fix for |
Unless I've missed something in the docs, the stdout of runners is restricted to a sub-portion of the overall runner output.
While most tools that we would house under st2 are cron, batch, daemon, and other types of non-interactive actions, there are some reporting tools where the full, unaltered output is necessary.
The best I've been able to come up with is reviewing the results of the last runner through the audit history.
I noticed that the Roadmap includes better output support -- is this the same thing?
The text was updated successfully, but these errors were encountered: