Coder Social home page Coder Social logo

awesome_spawn's Introduction

ManageIQ

CI Code Climate Codacy Coverage Status

License Chat Translate Open Source Helpers

OpenSSF Best Practices OpenSSF Scorecard CNCF Landscape

Build history for master branch

Discover, Optimize, and Control your Hybrid IT

Manage containers, virtual machines, networks, and storage from a single platform

ManageIQ is an open-source Management Platform that delivers the insight, control, and automation that enterprises need to address the challenges of managing hybrid IT environments. It has the following feature sets:

  • Insight: Discovery, Monitoring, Utilization, Performance, Reporting, Analytics, Chargeback, and Trending.
  • Control: Security, Compliance, Alerting, Policy-Based Resource and Configuration Management.
  • Automate: IT Process, Task and Event, Provisioning, Workload Management and Orchestration.
  • Integrate: Systems Management, Tools and Processes, Event Consoles, CMDB, RBA, and Web Services.

Get Started

Learn more

We respectfully ask that you do not directly email any manageiq committers with questions or problems. The community is best served when discussions are held in public.

Licensing

See LICENSE.txt.

Except where otherwise noted, all ManageIQ source files are covered by the following copyright and license notice:

Copyright (c) 2014-present ManageIQ Authors.

Export Notice

By downloading ManageIQ software, you acknowledge that you understand all of the following: ManageIQ software and technical information may be subject to the U.S. Export Administration Regulations (the "EAR") and other U.S. and foreign laws and may not be exported, re-exported or transferred (a) to any country listed in Country Group E:1 in Supplement No. 1 to part 740 of the EAR (currently, Cuba, Iran, North Korea, Sudan & Syria); (b) to any prohibited destination or to any end user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government; or (c) for use in connection with the design, development or production of nuclear, chemical or biological weapons, or rocket systems, space launch vehicles, or sounding rockets, or unmanned air vehicle systems. You may not download ManageIQ software or technical information if you are located in one of these countries or otherwise subject to these restrictions. You may not provide ManageIQ software or technical information to individuals or entities located in one of these countries or otherwise subject to these restrictions. You are also responsible for compliance with foreign law requirements applicable to the import, export and use of ManageIQ software and technical information.

awesome_spawn's People

Contributors

agrare avatar bdunne avatar carbonin avatar chessbyte avatar d-m-u avatar fryguy avatar isimluk avatar jrafanie avatar kbrock avatar mend-bolt-for-github[bot] avatar nicklamuro avatar renovate[bot] avatar simaishi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

awesome_spawn's Issues

build_command_line adds spaces to = arguments if specified in array

AwesomeSpawn.build_command_line("ls", :test= => "hello")
returns the good "ls --test=hello"

AwesomeSpawn.build_command_line("ls", [{:test= => "hello"}])
returns the bad "ls --test= hello"

AwesomeSpawn.build_command_line("ls", [:abc, {:test= => "hello"}])
returns the bad "ls --abc --test= hello"

[RFE] Pipes and redirects

Unix pipes and redirects are obviously extremely powerful for chaining multiple commands together, being able to support this nicely in AwesomeSpawn combined with AwesomeSpawn's CLI builder to prevent command injection.

Wishlist:

  1. Easily provide stdin, stdout, and stderr for a process. Allow String, File / IO for stdin, File / IO for stdout/stderr.

Using pipes to write to a process' stdin is a great way to securely provide a password without it showing up in ENV vars, and giving the calling process' $stdout as the subcommands stdout allows for realtime output without waiting for the possibly long running command to finish

  1. Easily chain commands together (aka pipe stdout from one to stdin of the next

Some bash examples that we should be able to do easily with AwesomeSpawn:

echo "hello" | sed  's/hello/goodbye/' > output.txt
AwesomeSpawn.run("sed", :in => "hello", :params => ["s/hello/goodbye/"], :out => File.new("output.txt", "w"))
AwesomeSpawn.pipe("echo", :params => ["'hello'"]).pipe("sed", :params => ["'s/hello/goodbye/'"], :out => "output.txt").run
sudo dnf upgrade 2>/dev/null
AwesomeSpawn.run("sudo", :stdin => "hunter2", :params => ["dnf", "upgrade"], :stdout => $stdout, :stderr => nil)

Add dry_run or safe_mode capability

For testing purposes, allow either a dry_run for "stubbing" the spawn or perhaps a global safe_mode option that raises an error if spawn ends up executing something.

Exclude devel files from gem

Hey I'm thinking some or all of following could be excluded from the gem:
.rspec .travis.yml .yardopts .gitignore Gemfile Rakefile

.travis & .gitignore don't really belong, Gemfile/Rakefile are more questionable.

These are the files being removed in the awesome_spawn rpm spec, it's fine if they are left in the gem but will need to be rm'd there:

https://bugzilla.redhat.com/show_bug.cgi?id=1055789

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

bundler
Gemfile
github-actions
.github/workflows/ci.yaml
  • actions/checkout v4
  • ruby/setup-ruby v1
  • paambaati/codeclimate-action v8

  • Check this box to trigger a request for Renovate to run again on this repository

[RFE] Disallow spaces in the command parameter

This would enforce the usage of the :params when needed, and a user would not be able to bypass it. If they are going to bypass anyway, then there is no point in using AwesomeSpawn.

The only use case we might have to account for is sudo. I say might, because one case easily do

AwesomeSpawn.run!("sudo", :params => ["echo", "hi")

But that is kind of weird. I think I'd prefer another param:

AwesomeSpawn.run!("echo", :params => "hi", :sudo => true)
AwesomeSpawn.run!("echo", :params => "hi", :sudo => "someuser")

Which would be nice because a caller could build the options and call it, then on failure just tack in another option (instead of having to re-call AwesomeSpawn and reorder all of the params.

Deal with bare params in associative array by not having keys

For example, to generate git log feature -E --grep abc you currently have to do

:params => {"log" => nil, "feature" => nil, "-E" => nil, "--grep" => "abc"}
# or
:params => {nil => ["log", "feature"], "-E" => nil, "--grep" => "abc"}
# or
:params => {nil => ["log", "feature", "-E"], "--grep" => "abc"}
# or as an associative Array
:params => [nil, ["log", "feature", "-E"]], ["--grep", "abc"]]

but that nil is clunky. I propose that we allow bareword params as "alone" values to expand our associative Array support

:params => ["log", "feature", "-E", ["--grep", "abc"]]
# and/or
:params => ["log", "feature", "-E", {"--grep" => "abc"}]

incidentally, with symbol support in #5, this would become

:params => ["log", "feature", "-E", [:grep, "abc"]]
# and/or
:params => ["log", "feature", "-E", {:grep => "abc"}]

which is pretty elegant.

Conditionalize coveralls

Currently the coveralls dep gets commented out in the awesome_spawn rpm spec.

Would be nice to just gracefully catch the load error / continue on if coveralls can't be loaded

[RFE] Better params ergonomics

A typical command is currently:

AwesomeSpawn.run!("ls", :params => [:a, :l])

Most times, params are needed (because sanitizing them is the point of using AwesomeSpawn, otherwise you'd probably just use backticks). But that params key is clunky.

Additionally, the params key is not passed to AwesomeSpawn.build_command_line

AwesomeSpawn.build_command_line("ls", [:a, :l])
# => "ls -a -l"

As such, I propose we drop the params key altogether, and make it part of the "command" portion via Array or Hash. So, I could see one or all of

AwesomeSpawn.run!("ls" => [:a, :l])
AwesomeSpawn.run!(["ls", [:a, :l]])
AwesomeSpawn.run!("ls", [:a, :l])

I kind of like the first one, and the second one is just an associative array version of the first (i.e. it's the same as .to_a), so it's straightfoward to implement.

Then, we should make build_command_line have the exact same interface.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.