Skip to content

Commit

Permalink
switch to 2.28 in saas and introduce legacy keyword for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
karmab committed Dec 19, 2023
1 parent b01f1ab commit 71a9604
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
kcli create sushy-service
- name: Install aicli
run: |
pip3 install -U 'assisted-service-client<2.28.0.post1'
pip3 install -U assisted-service-client
python3 setup.py install
- name: Clean up
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
kcli create sushy-service
- name: Install aicli
run: |
pip3 install -U 'assisted-service-client<2.28.0.post1'
pip3 install -U assisted-service-client
python3 setup.py install
- name: Clean up
continue-on-error: true
Expand Down
47 changes: 21 additions & 26 deletions ailib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def __init__(self, url='https://api.openshift.com', token=None, offlinetoken=Non
except Exception as e:
error(f"Hit issue when trying to set token. Got {e}")
if os.path.exists(offlinetokenpath):
error("Removing offlinetoken file")
os.remove(offlinetokenpath)
error(f"Moving wrong offlinetoken file to {offlinetokenpath}.old")
move(offlinetokenpath, "{offlinetokenpath}.old")
sys.exit(1)
self.config.api_key['Authorization'] = self.token
self.config.api_key_prefix['Authorization'] = 'Bearer'
Expand Down Expand Up @@ -196,39 +196,34 @@ def get_default_ssh_pub():
return pubpath

def set_default_values(self, overrides, existing=False, quiet=False):
legacy = overrides.get('legacy', False)
if 'openshift_version' in overrides:
if isinstance(overrides['openshift_version'], float):
overrides['openshift_version'] = str(overrides['openshift_version'])
if overrides['openshift_version'] == 4.1:
overrides['openshift_version'] = '4.10'
# service_networks = overrides.get('service_networks', [])
# dual = len(service_networks) > 1 and ':' in service_networks[1]
api_vips = overrides.get('api_vips', [])
api_vip = overrides.get('api_vip') or overrides.get('api_ip')
if api_vip is not None:
overrides['api_vip'] = api_vip
# if not dual:
# if 'api_ip' in overrides:
# del overrides['api_ip']
# if 'api_vip' in overrides:
# del overrides['api_vip']
# warning("Ignoring api_ip at creation time", quiet=quiet or existing)
if legacy:
overrides['api_vip'] = api_vip
else:
if 'api_vip' in overrides:
del overrides['api_vip']
if api_vip not in api_vips:
api_vips.append({'ip': api_vip})
overrides['api_vips'] = api_vips
ingress_vips = overrides.get('ingress_vips', [])
ingress_vip = overrides.get('ingress_vip') or overrides.get('ingress_ip')
if ingress_vip is not None:
overrides['ingress_vip'] = ingress_vip
# if not dual:
# if 'ingress_ip' in overrides:
# del overrides['ingress_ip']
# if 'ingress_vip' in overrides:
# del overrides['ingress_vip']
# warning("Ignoring ingress_ip at creation time", quiet=quiet or existing)
# api_vips = overrides.get('api_vips', [])
# if not dual and api_vips:
# warning("Ignoring api_vips at creation time", quiet=quiet or existing)
# del overrides['api_vips']
# ingress_vips = overrides.get('ingress_vips', [])
# if not dual and ingress_vips:
# warning("Ignoring ingress_vips at creation time", quiet=quiet or existing)
# del overrides['ingress_vips']
if legacy:
overrides['ingress_vip'] = ingress_vip
else:
if 'ingress_vip' in overrides:
del overrides['ingress_vip']
if ingress_vip not in ingress_vips:
ingress_vips.append({'ip': ingress_vip})
overrides['ingress_vips'] = ingress_vips
if not existing:
if 'pull_secret' not in overrides:
warning("Using openshift_pull.json as pull_secret file", quiet=quiet)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages

import os
INSTALL = ['assisted-service-client<2.28.0.post1', 'prettytable', 'PyYAML']
INSTALL = ['assisted-service-client', 'prettytable', 'PyYAML']
description = 'Assisted installer assistant'
long_description = description
if os.path.exists('README.rst'):
Expand Down

0 comments on commit 71a9604

Please sign in to comment.