diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-11-23 20:43:12 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-11-23 21:51:28 +0100 |
commit | 28876566144cc74a32eb45f2fa4d966ebef8b0b2 (patch) | |
tree | ba662f984e685c53a46526b50d8fc560ce62fcc7 /branding | |
parent | cdc80c3677753ad6eea8d864552077042bd9abb0 (diff) |
[pkg] allow multi-provider
Diffstat (limited to 'branding')
-rwxr-xr-x | branding/scripts/gen-providers-json | 15 | ||||
-rwxr-xr-x | branding/scripts/generate-debian | 4 | ||||
-rwxr-xr-x | branding/scripts/generate-snap | 4 | ||||
-rwxr-xr-x | branding/scripts/generate-vendor-make | 4 | ||||
-rwxr-xr-x | branding/scripts/getparam | 6 | ||||
-rw-r--r-- | branding/scripts/provider.py | 5 |
6 files changed, 19 insertions, 19 deletions
diff --git a/branding/scripts/gen-providers-json b/branding/scripts/gen-providers-json index 0c95cb9..8fd64c6 100755 --- a/branding/scripts/gen-providers-json +++ b/branding/scripts/gen-providers-json @@ -5,8 +5,7 @@ import json import os import sys - -from provider import getDefaultProvider +from provider import getDefaultProviders from provider import getProviderData OUTFILE = 'providers.json' @@ -22,14 +21,14 @@ def generateProvidersJSON(configPath, outputJSONPath): # For multi-provider, just add more providers to the dict providers = {} - defaultProvider = getDefaultProvider(config) + defaultProviders = getDefaultProviders(config) - providers['default'] = defaultProvider + providers['default'] = defaultProviders[0] providers['providers'] = [] - providerData = getProviderData(defaultProvider, config) - addCaData(providerData, configPath) - - providers['providers'].append(providerData) + for p in defaultProviders: + providerData = getProviderData(p, config) + addCaData(providerData, configPath) + providers['providers'].append(providerData) with open(outputJSONPath, 'w', encoding='utf-8') as f: json.dump(providers, f, ensure_ascii=False, indent=4) diff --git a/branding/scripts/generate-debian b/branding/scripts/generate-debian index 0db1fde..7a572ce 100755 --- a/branding/scripts/generate-debian +++ b/branding/scripts/generate-debian @@ -6,7 +6,7 @@ import sys import configparser -from provider import getDefaultProvider +from provider import getDefaultProviders from provider import getProviderData @@ -24,7 +24,7 @@ if __name__ == "__main__": configFile = os.path.join(VENDOR_PATH, 'vendor.conf') config = configparser.ConfigParser() config.read(configFile) - provider = getDefaultProvider(config) + provider = getDefaultProviders(config)[0] data = getProviderData(provider, config) if len(sys.argv) != 2: diff --git a/branding/scripts/generate-snap b/branding/scripts/generate-snap index 3271d9e..0cb0f19 100755 --- a/branding/scripts/generate-snap +++ b/branding/scripts/generate-snap @@ -6,7 +6,7 @@ import sys import configparser -from provider import getDefaultProvider +from provider import getDefaultProviders from provider import getProviderData @@ -25,7 +25,7 @@ if __name__ == "__main__": configFile = os.path.join(VENDOR_PATH, 'vendor.conf') config = configparser.ConfigParser() config.read(configFile) - provider = getDefaultProvider(config) + provider = getDefaultProviders(config)[0] data = getProviderData(provider, config) if len(sys.argv) != 2: diff --git a/branding/scripts/generate-vendor-make b/branding/scripts/generate-vendor-make index 60dc180..9844e6a 100755 --- a/branding/scripts/generate-vendor-make +++ b/branding/scripts/generate-vendor-make @@ -8,7 +8,7 @@ import sys import configparser -from provider import getDefaultProvider +from provider import getDefaultProviders from provider import getProviderData @@ -40,7 +40,7 @@ if __name__ == "__main__": configFile = os.path.join(VENDOR_PATH, 'vendor.conf') config = configparser.ConfigParser() config.read(configFile) - provider = getDefaultProvider(config) + provider = getDefaultProviders(config)[0] data = getProviderData(provider, config) if len(sys.argv) != 2: diff --git a/branding/scripts/getparam b/branding/scripts/getparam index 005abb1..100cb5d 100755 --- a/branding/scripts/getparam +++ b/branding/scripts/getparam @@ -8,7 +8,7 @@ import configparser import os import sys -from provider import getDefaultProvider +from provider import getDefaultProviders from provider import getProviderData def getData(): @@ -20,8 +20,8 @@ def getData(): sys.exit(1) config = configparser.ConfigParser() config.read(configPath) - defaultProvider = getDefaultProvider(config) - return getProviderData(getDefaultProvider(config), config) + defaultProvider = getDefaultProviders(config)[0] + return getProviderData(defaultProvider, config) if __name__ == "__main__": param = sys.argv[1] diff --git a/branding/scripts/provider.py b/branding/scripts/provider.py index 90daa13..7900feb 100644 --- a/branding/scripts/provider.py +++ b/branding/scripts/provider.py @@ -2,14 +2,15 @@ import datetime import os -def getDefaultProvider(config): +def getDefaultProviders(config): + # returns a list of providers provider = os.environ.get('PROVIDER') if provider: print('[+] Got provider {} from environment'.format(provider)) else: print('[+] Using default provider from config file') provider = config['default']['provider'] - return provider + return provider.split(',') def getProviderData(provider, config): |