From 3cd1d7ea6128bbb0ea0b806e7b029916a21fca71 Mon Sep 17 00:00:00 2001 From: Marc Serrat Date: Wed, 15 Apr 2020 17:36:50 +0200 Subject: [PATCH 1/2] Fix for initial version import --- VERSION | 2 +- apsconnectcli/hub.py | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/VERSION b/VERSION index 1d3e94f..a1b945c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -19.3 +19.4 diff --git a/apsconnectcli/hub.py b/apsconnectcli/hub.py index ac3a903..ae00bd7 100644 --- a/apsconnectcli/hub.py +++ b/apsconnectcli/hub.py @@ -242,22 +242,6 @@ def create_instance(self, package, oauth_key, oauth_secret, backend_url, setting }, } - if 'hubId' in package.app_properties: - if not self.hub_id and not hub_id: - raise Exception("Core OA resource is not found\n" - "Use --hub-id={value} argument to specify the ID " - "manually or --hub-id=auto to generate it automatically") - elif self.hub_id: - hub_id = self.hub_id - elif hub_id == 'auto': - hub_id = str(uuid.uuid4()) - - payload.update({ - 'app': { - 'hubId': hub_id - } - }) - payload.update(settings) r = self.aps.post('aps/2/applications/', json=payload) @@ -658,6 +642,8 @@ def get_application_id(self, package_id): r = self.osaapi.aps.getApplications(**payload) osaapi_raise_for_status(r) + if len(r['result']) == 0: + return None return r['result'][0]['application_id'] or None def get_application_instances(self, application_id): From c87da09267e8a4df8abdd782c750ad60669e581c Mon Sep 17 00:00:00 2001 From: Marc Serrat Date: Wed, 15 Apr 2020 17:40:23 +0200 Subject: [PATCH 2/2] Remove unused import --- apsconnectcli/hub.py | 1 - 1 file changed, 1 deletion(-) diff --git a/apsconnectcli/hub.py b/apsconnectcli/hub.py index ae00bd7..49ec9d2 100644 --- a/apsconnectcli/hub.py +++ b/apsconnectcli/hub.py @@ -3,7 +3,6 @@ import json import re import sys -import uuid from xml.etree import ElementTree as xml_et