1313# * See the License for the specific language governing permissions and
1414# * limitations under the License.
1515
16- import errno
1716import os
17+ import errno
1818import warnings
1919from contextlib import contextmanager
2020
21- from cloudify_rest_client .exceptions import CloudifyClientError
22- from cloudify .endpoint import ManagerEndpoint , LocalEndpoint
23- from cloudify .logs import init_cloudify_logger
21+ from cloudify import utils
2422from cloudify import constants
2523from cloudify import exceptions
26- from cloudify import utils
24+ from cloudify .logs import init_cloudify_logger
25+ from cloudify .endpoint import ManagerEndpoint , LocalEndpoint
26+ from cloudify_rest_client .exceptions import CloudifyClientError
2727from cloudify .constants import DEPLOYMENT , NODE_INSTANCE , RELATIONSHIP_INSTANCE
2828
2929
@@ -404,7 +404,10 @@ def properties(self):
404404 These properties are the properties specified in the blueprint.
405405 """
406406 self ._get_node_if_needed ()
407- return self ._node .properties
407+ try :
408+ return self ._node .properties
409+ except AttributeError :
410+ return self ._node .get ('properties' )
408411
409412 @property
410413 def type (self ):
@@ -424,6 +427,16 @@ def number_of_instances(self):
424427 self ._get_node_if_needed ()
425428 return self ._node .number_of_instances
426429
430+ @property
431+ def is_external (self ) -> bool :
432+ """If this is a resource that Cloudify manages or not"""
433+ return self .properties .get ('use_external_resource' , False )
434+
435+ @property
436+ def resource_id (self ):
437+ """The resource's ID outside of Cloudify"""
438+ return self .properties .get ('resource_id' )
439+
427440
428441class NodeInstanceContext (EntityContext ):
429442 def __init__ (self , * args , ** kwargs ):
0 commit comments