mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 12:51:25 -07:00
removes assert and uses to_list common function (#20866)
non impacting change to refactor assert statement out of ios shared module
This commit is contained in:
parent
327ad42ff2
commit
9ab0a49ef2
1 changed files with 2 additions and 3 deletions
|
@ -25,6 +25,7 @@
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
from ansible.module_utils.network_common import to_list
|
||||||
|
|
||||||
_DEVICE_CONFIGS = {}
|
_DEVICE_CONFIGS = {}
|
||||||
|
|
||||||
|
@ -44,10 +45,8 @@ def get_config(module, flags=[]):
|
||||||
return cfg
|
return cfg
|
||||||
|
|
||||||
def run_commands(module, commands, check_rc=True):
|
def run_commands(module, commands, check_rc=True):
|
||||||
assert isinstance(commands, list), 'commands must be a list'
|
|
||||||
responses = list()
|
responses = list()
|
||||||
|
for cmd in to_list(commands):
|
||||||
for cmd in commands:
|
|
||||||
rc, out, err = module.exec_command(cmd)
|
rc, out, err = module.exec_command(cmd)
|
||||||
if check_rc and rc != 0:
|
if check_rc and rc != 0:
|
||||||
module.fail_json(msg=err, rc=rc)
|
module.fail_json(msg=err, rc=rc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue