Closed ramereth closed 5 years ago
Build succeeded.
Please review @dhague, @Ladas, @seanhandley, @mdarby and @jjasghar
Hi @ramereth
Thanks for the PR! I'd like to understand a little more about this issue.
First of all, how is the string becoming frozen? Is something in chef freezing it?
Second, I don't quite see how your code change would fix the offending behaviour. Can you help me understand why this change helps?
@seanhandley I'm not entirely sure what's causing the string to become frozen but I did some debugging and did confirm that when I run it within chef as a library, it returns as a frozen string. I could consult with some other Chef folks if you would like.
Regarding how this code changes the offending behavior, Using gsub!
means the string variable gets changed in place which is a problem if the variable is frozen. To work around that, I use gsub
instead which returns the changed string and I simply just copy the result back into the same variable.
It seems when using fog-openstack-1.x with Chef [1] , @openstack_endpoint_type becomes a frozen string and fails with FrozenError. Unfortunately, I haven't been able to reproduce this issue in unit tests but I know for a fact that this fixes the issue. Looking through the code base, this is the only place where a
gsub!
is used in this manner.Further debugging shows this stack trace which lead me to this:
[1] https://review.opendev.org/665827