Skip to content

Commit

Permalink
Remove Certificates property in GoalState
Browse files Browse the repository at this point in the history
  • Loading branch information
maddieford committed Dec 22, 2022
1 parent c61a067 commit dd9d8da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions azurelinuxagent/common/protocol/goal_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ class GoalStateProperties(object):
HostingEnv = 0x2
SharedConfig = 0x4
ExtensionsGoalState = 0x8
Certificates = 0x10
RemoteAccessInfo = 0x20
All = RoleConfig | HostingEnv | SharedConfig | ExtensionsGoalState | Certificates | RemoteAccessInfo
RemoteAccessInfo = 0x10
All = RoleConfig | HostingEnv | SharedConfig | ExtensionsGoalState | RemoteAccessInfo


class GoalStateInconsistentError(ProtocolError):
Expand Down Expand Up @@ -139,13 +138,6 @@ def extensions_goal_state(self):
else:
return self._extensions_goal_state

@property
def certs(self):
if not self._goal_state_properties & GoalStateProperties.Certificates:
raise ProtocolError("Certificates is not in goal state properties")
else:
return self._certs

@property
def hosting_env(self):
if not self._goal_state_properties & GoalStateProperties.HostingEnv:
Expand Down Expand Up @@ -436,7 +428,7 @@ def _fetch_full_wire_server_goal_state(self, incarnation, xml_doc):

certs = EmptyCertificates()
certs_uri = findtext(xml_doc, "Certificates")
if (GoalStateProperties.Certificates & self._goal_state_properties) and certs_uri is not None:
if (GoalStateProperties.ExtensionsGoalState & self._goal_state_properties) and certs_uri is not None:
xml_text = self._wire_client.fetch_config(certs_uri, self._wire_client.get_header_for_cert())
certs = Certificates(xml_text, self.logger)
# Log and save the certificates summary (i.e. the thumbprint but not the certificate itself) to the goal state history
Expand Down
2 changes: 1 addition & 1 deletion tests/protocol/test_wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ def test_forced_update_should_update_the_goal_state_and_the_host_plugin_when_the

def test_reset_should_init_provided_goal_state_properties(self):
with mock_wire_protocol(mockwiredata.DATA_FILE) as protocol:
protocol.client.reset_goal_state(goal_state_properties=GoalStateProperties.All & ~GoalStateProperties.Certificates)
protocol.client.reset_goal_state(goal_state_properties=GoalStateProperties.All & ~GoalStateProperties.ExtensionsGoalState)

with self.assertRaises(ProtocolError) as context:
_ = protocol.client.get_certs()
Expand Down

0 comments on commit dd9d8da

Please sign in to comment.