Skip to content

Commit

Permalink
Merge pull request #41 from nicholasmhughes/fix-cloud-exec-module-access
Browse files Browse the repository at this point in the history
Fix cloud exec module access
  • Loading branch information
nicholasmhughes authored Aug 14, 2023
2 parents a658897 + b912d1b commit 9f6378f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ This project uses [Semantic Versioning](https://semver.org/) - MAJOR.MINOR.PATCH

# Changelog

# Saltext.Azurerm 4.0.1 (2023-08-14)

### Fixed

- Fix NameError for __salt__ access and a public IP KeyError (#40)


# Saltext.Azurerm 4.0.0 (2023-08-14)

### Added
Expand Down
16 changes: 13 additions & 3 deletions src/saltext/azurerm/clouds/azurerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@

import salt.cache # pylint: disable=import-error
import salt.config as config # pylint: disable=import-error
import salt.loader # pylint: disable=import-error
import salt.utils.cloud # pylint: disable=import-error
import salt.utils.files # pylint: disable=import-error
import salt.utils.stringutils # pylint: disable=import-error
Expand All @@ -124,6 +123,16 @@
except ImportError:
pass

try:
__salt__ # pylint: disable=used-before-assignment
except NameError:
import salt.loader # pylint: disable=import-error

__opts__ = salt.config.minion_config("/etc/salt/minion")
__utils__ = salt.loader.utils(__opts__)
__salt__ = salt.loader.minion_mods(__opts__, utils=__utils__)


__virtualname__ = "azurerm"

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -643,8 +652,9 @@ def _get_network_interface(name, resource_group):
ip_config["public_ip_address"]["id"], netapi_version, "name"
)
public_ip = _get_public_ip(public_ip_name, resource_group)
public_ips.append(public_ip["ip_address"])
netiface["ip_configurations"][index]["public_ip_address"].update(public_ip)
if public_ip.get("ip_address"):
public_ips.append(public_ip["ip_address"])
netiface["ip_configurations"][index]["public_ip_address"].update(public_ip)

return netiface, public_ips, private_ips

Expand Down
2 changes: 1 addition & 1 deletion src/saltext/azurerm/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# pylint: disable=missing-module-docstring
__version__ = "4.0.0"
__version__ = "4.0.1"

0 comments on commit 9f6378f

Please sign in to comment.