question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improved ways to get raw output from the shell.

See original GitHub issue

Is your feature request related to a problem? Please describe

So I’m often needing ways to branch python code based on actual raw output from a shell command (Use case: in-depth system audits).

host.fact.command() does this fairly well, but it lacks any ability to switch users or permissions on the fly. Operations have plenty of ways to do this using parameters such as sudo= use_sudo_password= su_user=… etc.

Describe the solution you’d like

One or more of the following would be ideal.

  • Give host.fact.command() some form of equivalent to the user switching parameters enjoyed by Operations.
  • Allow us to get raw output from the server.shell() Operation.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Fizzadarcommented, Apr 1, 2021

Update on this: have implemented the change in https://github.com/Fizzadar/pyinfra/pull/516/commits/bc9d1182c8a76eb4171c4fb1ba5509e2ed2d1b66; need to add some tests and then should be good to go for 1.4 release shortly!

1reaction
Fizzadarcommented, Mar 24, 2021

I think this is an absolute must-have; I’m going to implement this alongside the new explicit fact imports functionality, so can do:

host.get_fact(AptSources, sudo=True)

Will have the neat side effect of allowing operations to customise fact global arguments they use (by default facts called by an operation inherit the operation args).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I get the raw formatting output of commands?
Use script /tmp/output to start recording in a new shell, then type your commands and look in the /tmp/output file, e.g. with an...
Read more >
How to Upgrade a Dumb Shell to a Fully Interactive ... - Null Byte
Step 2Spawn a Bash Shell ... One of the easiest and most reliable ways to upgrade a dumb shell to a fully interactive...
Read more >
shell script: convert raw output (from dict lines into csv) [closed]
Can anyone help me to convert below raw output to csv or a key value pair . i have tried awk , sed...
Read more >
Upgrading Simple Shells to Fully Interactive TTYs - ropnop blog
Generating reverse shell commands. Everyone is pretty familiar with the traditional way of using netcat to get a reverse shell: ...
Read more >
Improving shell workflows with fzf - Sebastian Jambor's blog
One way to improve shell workflows is finding patterns in the execution order of commands and extracting those into little scripts; this can ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found