Skip to content

Commit

Permalink
fixed vmware brownfield app creation (#272)
Browse files Browse the repository at this point in the history
CALM-38760: Failed to create VMWare brownfield app

Issue Link: https://jira.nutanix.com/browse/CALM-38760

Description:
1. Fixed guest.ipAddress field depending on calm version

<img width="1160" alt="image"
src="https://github.com/ideadevice/calm-dsl/assets/123161845/f3f47773-0ca9-42dd-9e1a-f3deabc7b27b">

(cherry picked from commit 3e4c58e75ca07d8bdc0bbf85d78147b9aa88a8ab)
  • Loading branch information
dwivediprab committed Mar 15, 2024
1 parent 20b8306 commit b34e668
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion calm/dsl/builtins/models/brownfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from .validator import PropertyValidator
from .deployment import DeploymentType
from .metadata_payload import get_metadata_obj
from distutils.version import LooseVersion as LV

from .helper import common as common_helper
from calm.dsl.config import get_context
from calm.dsl.store import Cache
from calm.dsl.api import get_api_client
from calm.dsl.constants import CACHE, PROVIDER_ACCOUNT_TYPE_MAP
from calm.dsl.log import get_logging_handle
from calm.dsl.store import Version

LOG = get_logging_handle(__name__)

Expand Down Expand Up @@ -303,6 +305,8 @@ def get_vmware_bf_vm_data(
):
"""Return vmware vm data matched with provided instacne details"""

CALM_VERSION = Version.get_version("Calm")

client = get_api_client()

params = {
Expand Down Expand Up @@ -331,7 +335,12 @@ def get_vmware_bf_vm_data(
e_name = e_resources["instance_name"]
e_id = e_resources["instance_id"]
e_address = e_resources["address"]
e_address_list = e_resources["guest.ipAddress"]

# fixes: https://github.com/nutanix/calm-dsl/issues/226 (KeyError: 'guest.ipAddress')
if LV(CALM_VERSION) >= LV("3.3.0"):
e_address_list = e_resources["guest_ipaddress"]
else:
e_address_list = e_resources["guest.ipAddress"]

if match_vm_data(
vm_name=e_name,
Expand Down

0 comments on commit b34e668

Please sign in to comment.