Eliminate file check in Armada required function.

Previously the function was basing a decision whether
or not Armada is required soley on whether or not
the folder /opt/platform/armada exists or not.  There
might be the condition where an Armada application was
installed on a lower version of STX, then upgraded to
FluxCD, and the old armada manifests left over.  This
change seeks to make the determination about Armada
being required solely upon the helm2 cli showing a release
and if a pod existing in the armada namespace existing with
the "application=armada" label.

Test Plan:
PASS: Upgrade activation step between stx9.0 and future
      stx10.0 and 76 script passes.
PASS: Force install an old armada application to check
      if the 76 script leaves armada in place. In this
      case the Armada pod is detected and the script
      exit and activation fails as it should.

Closes-Bug:2065320

Change-Id: I50dabe843549f7f84522c2a61056560c5c084da5
Signed-off-by: Joshua Reed <joshua.reed@windriver.com>
This commit is contained in:
Joshua Reed 2024-05-09 09:21:52 -06:00 committed by Reed, Joshua
parent 69e075e250
commit 83f9b48a47
1 changed files with 6 additions and 11 deletions

View File

@ -197,18 +197,13 @@ def has_armada_pod():
def is_armada_required():
"""
Check for armada manifests or helm v2 releases.
Return True if any are found,
False otherwise (including if helm v2 was already removed).
"""
Check for Armada pods with application=armada label in namespace
armada.
# Check if there armada apps uploaded/applied, exit if there are any
if os.path.exists(ARMADA_MANIFEST_DIRECTORY):
for sw_version in os.listdir(ARMADA_MANIFEST_DIRECTORY):
directory = os.path.join(ARMADA_MANIFEST_DIRECTORY, sw_version)
if os.listdir(directory):
LOG.debug("Armada apps found: " + str(os.listdir(directory)))
return True
Check for helm v2 releases as an additional check.
Return True if both are found, False otherwise.
"""
# Check for releases in helm v2, exit if there are any
if has_helmv2_cli() and has_armada_pod():