From c38e1d1adb3374e8e72cc378535a0fab0dc096d7 Mon Sep 17 00:00:00 2001 From: Youry De Winter Date: Fri, 15 Sep 2023 09:50:02 +0200 Subject: [PATCH] Update inventory.py to use vars in inventory Currently it is using os environment variables, this change allows the use of variables in the inventory itself --- plugins/inventory/inventory.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/inventory/inventory.py b/plugins/inventory/inventory.py index a5e3a53..1185f56 100644 --- a/plugins/inventory/inventory.py +++ b/plugins/inventory/inventory.py @@ -158,10 +158,10 @@ def parse(self, inventory, loader, path, cache=False): # Try getting variables from env try: - host = os.getenv("MAAS_HOST") - token_key = os.getenv("MAAS_TOKEN_KEY") - token_secret = os.getenv("MAAS_TOKEN_SECRET") - customer_key = os.getenv("MAAS_CUSTOMER_KEY") + host = self.get_option("maas_host") + token_key = self.get_option("maas_token_key") + token_secret = self.get_option("maas_token_secret") + customer_key = self.get_option("maas_customer_key") except KeyError: raise errors.MaasError( "Missing parameters: MAAS_HOST, MAAS_TOKEN_KEY, MAAS_TOKEN_SECRET, MAAS_CUSTOMER_KEY."