monitorstack/monitorstack/utils/cli.py
Michael Rice b676952bbe Adding vg_check from the maas plugins
This change adds the volume group check from the
maas plugins, and also adds a cli helper to run bash command.

Change-Id: I303a843b0abaea721758e182a9c8f3e2db33e85d
Signed-off-by: Michael Rice <michael.rice@rackspace.com>
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-04-17 21:05:22 -05:00

27 lines
935 B
Python

# Copyright 2017, Michael Rice <michael@michaelrice.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import shlex
import subprocess
def run_command(arg):
proc = subprocess.Popen(shlex.split(arg),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=False)
out, err = proc.communicate()
ret = proc.returncode
return ret, out, err