File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,20 @@ def agent_status_since(self):
2626 """
2727 return pyrfc3339 .parse (self .safe_data ['agent-status' ]['since' ])
2828
29+ @property
30+ def is_subordinate (self ):
31+ """True if the unit is subordinate of another unit
32+
33+ """
34+ return self .safe_data ['subordinate' ]
35+
36+ @property
37+ def principal_unit (self ):
38+ """Returns the name of the unit of which this unit is a subordinate to.
39+ Returns '' for principal units themselves.
40+ """
41+ return self .safe_data ['principal' ]
42+
2943 @property
3044 def agent_status_message (self ):
3145 """Get the agent status message.
@@ -77,6 +91,14 @@ def public_address(self):
7791 def tag (self ):
7892 return tag .unit (self .name )
7993
94+ def get_subordinates (self ):
95+ """Returns the unit objects that are subordinates to this unit
96+
97+ :return [Unit]
98+ """
99+ return [u for u_name , u in self .model .units .items () if u .is_subordinate and
100+ u .principal_unit == self .name ]
101+
80102 async def destroy (self ):
81103 """Destroy this unit.
82104
You can’t perform that action at this time.
0 commit comments