From 9b70f39b265f876eb686d864fc30590573e1b905 Mon Sep 17 00:00:00 2001 From: Bruno Goncalves Date: Mar 15 2018 15:12:50 +0000 Subject: fixed standard-inventory-rpm code using inspekt --- diff --git a/inventory/standard-inventory-rpm b/inventory/standard-inventory-rpm index c007387..7fca09f 100755 --- a/inventory/standard-inventory-rpm +++ b/inventory/standard-inventory-rpm @@ -1,5 +1,29 @@ #!/usr/bin/env python +# The MIT License (MIT) +# +# Copyright (c) 2017-2018 Red Hat Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Authors: Merlin Mathesius +# Stef Walter + import argparse import json import os @@ -41,17 +65,17 @@ def getlist(subjects): repos.append(subject) if repos or rpms: - vars = gethost(repos, rpms) - if vars: + host_vars = gethost(repos, rpms) + if host_vars: hosts.append("rpms") variables["rpms"] = vars - return { "subjects": { "hosts": hosts, "vars": { } }, "localhost": { "hosts": hosts, "vars": { } }, "_meta": { "hostvars": variables } } + return {"subjects": {"hosts": hosts, "vars": {}}, + "localhost": {"hosts": hosts, "vars": {}}, + "_meta": {"hostvars": variables}} def gethost(repos, rpms): - null = open(os.devnull, 'w') - # The variables variables = { "ansible_connection": "local"