1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 LOG = logging.getLogger(__name__)
16 def execute(cmd=None, care_result=True):
18 LOG.error('The cmd is None')
21 (status, ret) = commands.getstatusoutput(cmd)
22 if care_result and 0 != status:
23 LOG.error('CMD<%(cmd)s> \nSTDOUT:\n%(ret)s.', {'cmd':cmd, 'ret':ret})
27 except Exception as e: