Skip to content

Commit

Permalink
Fix custom resource
Browse files Browse the repository at this point in the history
Signed-off-by: Hanwen <[email protected]>
  • Loading branch information
hanwen-cluster committed Jul 14, 2023
1 parent 6f38929 commit edfba9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ def describe_cluster(cluster_name, region=None):
state=InstanceState.from_dict(head_node.state),
private_ip_address=head_node.private_ip,
)
login_nodes = _get_login_nodes(cluster)
if login_nodes:
response.login_nodes = login_nodes
except ClusterActionError as e:
# This should not be treated as a failure cause head node might not be running in some cases
# This should not be treated as a failure cause head node and login node might not be running in some cases.
# e.g. when the cluster is in DELETE_IN_PROGRESS
LOGGER.info(e)

login_nodes = _get_login_nodes(cluster)
if login_nodes:
response.login_nodes = login_nodes

return response


Expand Down
6 changes: 4 additions & 2 deletions tests/integration-tests/tests/custom_resource/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from troposphere import Output, Ref
from troposphere.iam import ManagedPolicy
from troposphere.template_generator import TemplateGenerator

from framework.fixture_utils import xdist_session_fixture
from utils import generate_stack_name


Expand Down Expand Up @@ -73,8 +75,8 @@ def cluster_custom_resource_provider_generator(cfn_stacks_factory, region, stack
yield stack.cfn_outputs.get("ServiceToken")


@pytest.fixture(scope="class", name="cluster_custom_resource_provider")
def cluster_custom_resource_provider_fixture(
@xdist_session_fixture()
def cluster_custom_resource_provider(
request,
region,
resource_bucket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,7 @@ def test_cluster_update_tag_propagation(


@pytest.mark.usefixtures("instance", "os", "region")
def test_cluster_delete_out_of_band(
cfn, cluster_custom_resource_provider, cluster_custom_resource_factory, pcluster_config_reader
):
def test_cluster_delete_out_of_band(cfn, cluster_custom_resource_factory, pcluster_config_reader):
"""Perform crud validation on cluster."""

stack = cluster_custom_resource_factory(pcluster_config_reader())
Expand All @@ -285,9 +283,7 @@ def test_cluster_delete_out_of_band(


@pytest.mark.usefixtures("instance", "os", "region")
def test_cluster_delete_retain(
cluster_custom_resource_provider, cluster_custom_resource_factory, pcluster_config_reader
):
def test_cluster_delete_retain(cluster_custom_resource_factory, pcluster_config_reader):
"""Perform crud validation on cluster."""

stack = cluster_custom_resource_factory(pcluster_config_reader(), deletion_policy="Retain")
Expand Down

0 comments on commit edfba9d

Please sign in to comment.