Skip to content

Commit

Permalink
Issue #3845 - Update the download woker to allow download cluster age…
Browse files Browse the repository at this point in the history
…nt image with architecture s390x

Signed-off-by: zhangl <[email protected]>
  • Loading branch information
LiilyZhang committed Jul 21, 2023
1 parent d5eee60 commit 0d15ec6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
15 changes: 8 additions & 7 deletions download/download_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
MACPACKAGETYPE = "pkg"

HZN_CLUSTER_FILE = "horizon-agent-edge-cluster-files.tar.gz"
HZN_CLUSTER_IMAGE = "amd64_anax_k8s.tar.gz"
HZN_CLUSTER_IMAGE = "%v_anax_k8s.tar.gz"
HZN_CONTAINER_FILE = "%v_anax.tar.gz"
HZN_EDGE_FILE = "horizon-agent-%v-%v-%v.tar.gz"
HZN_CONFIG_FILE = "agent-install.cfg"
Expand Down Expand Up @@ -486,20 +486,21 @@ func (w *DownloadWorker) formAgentUpgradePackageNames(dev *persistence.ExchangeD
return nil, "", fmt.Errorf("No node policy found in the local db.")
}

archProp, err := pol.Properties.GetProperty(externalpolicy.PROP_NODE_ARCH)
if err != nil {
return nil, "", err
}

if dev.GetNodeType() == persistence.DEVICE_TYPE_CLUSTER {
return &[]string{HZN_CLUSTER_FILE, HZN_CLUSTER_IMAGE}, "", nil
cluster_image := fmt.Sprintf(HZN_CLUSTER_IMAGE, archProp.Value)
return &[]string{HZN_CLUSTER_FILE, cluster_image}, "", nil
}

installTypeProp, err := pol.Properties.GetProperty(externalpolicy.PROP_NODE_OS)
if err != nil {
return nil, "", fmt.Errorf("Failed to find node os property: %v", err)
}

archProp, err := pol.Properties.GetProperty(externalpolicy.PROP_NODE_ARCH)
if err != nil {
return nil, "", err
}

allFiles := []string{}

containerizedProp, err := pol.Properties.GetProperty(externalpolicy.PROP_NODE_CONTAINERIZED)
Expand Down
3 changes: 2 additions & 1 deletion download/download_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package download

import (
"fmt"
"github.com/boltdb/bolt"
"github.com/open-horizon/anax/config"
"github.com/open-horizon/anax/cutil"
Expand Down Expand Up @@ -208,7 +209,7 @@ func Test_formAgentUpgradePackageNames(t *testing.T) {
t.Errorf("Expected 2 files for download. Got %v.", downloadFiles)
} else if !cutil.SliceContains(*downloadFiles, HZN_CLUSTER_FILE) {
t.Errorf("Did not find expected file %s for download. Got %v.", HZN_CLUSTER_FILE, downloadFiles)
} else if !cutil.SliceContains(*downloadFiles, HZN_CLUSTER_IMAGE) {
} else if !cutil.SliceContains(*downloadFiles, fmt.Sprintf(HZN_CLUSTER_IMAGE, "amd64")) {
t.Errorf("Did not find expected file %s for download. Got %v.", HZN_CLUSTER_IMAGE, downloadFiles)
}

Expand Down
2 changes: 1 addition & 1 deletion persistence/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c EstablishedAgreement) String() string {
"RunningWorkload: %v, "+
"AgreementTimeout: %v, "+
"ServiceDefId: %v, "+
"FailedVerAttempts: %v",
"FailedVerAttempts: %v"+
"LastVerAttemptUpdateTime: %v",
c.Name, c.DependentServices, c.Archived, c.CurrentAgreementId, c.ConsumerId, c.CounterPartyAddress, ServiceConfigNames(&c.CurrentDeployment),
"********", c.ProposalSig,
Expand Down

0 comments on commit 0d15ec6

Please sign in to comment.