[ClusterLabs Developers] Resource agent change review for azure-events
Reid Wahl
nwahl at redhat.com
Sun Dec 6 22:03:43 UTC 2020
Hi, Rich. Thanks for being proactive and proposing a fix when you
found an issue!
On Sun, Dec 6, 2020 at 8:04 AM Rich Paredes <Rich.Paredes at suse.com> wrote:
>
> Proposed commit is here:
> https://github.com/rfparedes/resource-agents/commit/4f6f5e9634092a3db2e61258f24165c6fecfadc5
>
> Specifically these changes are meant to fix "URLError is not defined" being generated when communication fails to IMDB for whatever reason, in this case due to the VM's underlying host having gone into unhealthy state:
> **2020-12-04T08:38:49.108342-05:00 HOST /azure-events: ERROR: name 'URLError' is not defined**
Can you confirm that you've tested with the upstream master version of
the resource agent? Based on these lines 14-19[1], also present in the
file in your commit, I don't see how we could reach a point where
URLError is not defined. So I wonder if you were using an older
version when you encountered the issue.
> In addition when the communication failure occurs, this adds specific failure notice to ocf_exit_reason for improved troubleshooting. Also, changes were made to exit when URLError exception is encountered as currently the response is read into the variable data when response is null:
> **ERROR: local variable 'data' referenced before assignment.**
I expect that this will be fixed when URLError is recognized. Note
that the assignment to `data` is in the `else` block of a
`try/except/else` sequence[2]. Thus it will not be reached if we match
the URLError exception and enter the `except` block.
With all of this in mind, I don't think we need to exit if we
encounter the URLError exception. The `data` variable will remain an
empty string, and `_sendMetadataRequest()` will return that empty
string to the caller.
> First commit here so hopefully I'm following the right procedure… Thanks.
We don't have a super formal process for resource-agents. You can
refer to the submitting[3] and maintaining[4] sections of the dev
guide for the general procedure.
Thanks again, and welcome!
[1] https://github.com/ClusterLabs/resource-agents/blob/f2bf1d8a07ea810099b03469883cb7f485ab9ac1/heartbeat/azure-events.in#L14-L19
[2] https://docs.python.org/3/tutorial/errors.html#handling-exceptions
[3] https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc#submitting-resource-agents
[4] https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc#maintaining-resource-agents
> -Rich
>
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/developers
>
> ClusterLabs home: https://www.clusterlabs.org/
>
--
Regards,
Reid Wahl, RHCA
Senior Software Maintenance Engineer, Red Hat
CEE - Platform Support Delivery - ClusterHA
More information about the Developers
mailing list