| |
@@ -3,10 +3,10 @@
|
| |
import argparse
|
| |
import json
|
| |
import os
|
| |
- import shlex
|
| |
import sys
|
| |
|
| |
- def main(argv):
|
| |
+
|
| |
+ def main():
|
| |
parser = argparse.ArgumentParser(description="Inventory for local")
|
| |
parser.add_argument("--list", action="store_true", help="Verbose output")
|
| |
parser.add_argument('--host', help="Get host variables")
|
| |
@@ -19,26 +19,29 @@
|
| |
data = list()
|
| |
sys.stdout.write(json.dumps(data, indent=4, separators=(',', ': ')))
|
| |
except RuntimeError as ex:
|
| |
- sys.stderr.write("{0}: {1}\n".format(os.path.basename(sys.argv[0]), str(ex)))
|
| |
+ sys.stderr.write("{0}: {1}\n".format(os.path.basename(sys.argv[0]),
|
| |
+ str(ex)))
|
| |
return 1
|
| |
-
|
| |
return 0
|
| |
|
| |
+
|
| |
def list():
|
| |
- rpms = [ ]
|
| |
- hosts = [ ]
|
| |
- variables = { }
|
| |
+ hosts = []
|
| |
+ variables = {}
|
| |
if os.environ.get("TEST_SUBJECTS", None) == "local":
|
| |
vars = host("local")
|
| |
if vars:
|
| |
hosts.append("local")
|
| |
variables["local"] = 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 host(host):
|
| |
if host == "local":
|
| |
- return { "ansible_connection": "local" }
|
| |
+ return {"ansible_connection": "local"}
|
| |
return None
|
| |
|
| |
+
|
| |
if __name__ == '__main__':
|
| |
- sys.exit(main(sys.argv))
|
| |
+ sys.exit(main())
|
| |
Remove unused import.
Groome code to pep8 style.