Skip to content

Commit

Permalink
feat: deprecation warnings on select application attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaqq committed Sep 27, 2024
1 parent bcbce1e commit c51de9b
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions juju/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import hashlib
import json
import logging
import typing
import warnings
from typing import Dict, List, Union
from pathlib import Path

from . import jasyncio, model, tag, utils
Expand All @@ -24,6 +25,42 @@


class Application(model.ModelEntity):
@property
def name(self) -> str:
return self.safe_data["name"]

@property
def exposed(self) -> bool:
return self.safe_data["exposed"]

@property
def owner_tag(self) -> str:
warnings.warn("Deprecated", DeprecationWarning)
return self.safe_data["owner-tag"]

@property
def life(self) -> str:
return self.safe_data["life"]

@property
def min_units(self) -> int:
warnings.warn("Deprecated", DeprecationWarning)
return self.safe_data["min-units"]

@property
def constraints(self) -> Dict[str, Union[str, int, bool]]:
return self.safe_data["constraints"]

@property
def subordinate(self) -> bool:
warnings.warn("Deprecated", DeprecationWarning)
return self.safe_data["subordinate"]

@property
def workload_version(self) -> str:
warnings.warn("Deprecated, use Unit.workload_version instead", DeprecationWarning)
return self.safe_data["workload-version"]

@property
def _unit_match_pattern(self):
return r'^{}.*$'.format(self.entity_id)
Expand Down Expand Up @@ -63,7 +100,7 @@ def subordinate_units(self):
return [u for u in self.units if u.is_subordinate]

@property
def relations(self) -> typing.List[Relation]:
def relations(self) -> List[Relation]:
return [rel for rel in self.model.relations if rel.matches(self.name)]

def related_applications(self, endpoint_name=None):
Expand Down

0 comments on commit c51de9b

Please sign in to comment.