custom type/provider case insensitive title

asked 2017-12-28 16:28:40 -0500

ruckc gravatar image

Is there anyway to normalize the title value through a munge call or something similiar?

I have a custom type/provider that manages local group membership on Windows machines (we needed more granularity over group membership, than just inside the user/group types.

group_member{"Group => Member":
   ensure=>present,
}

group_member{"Group => DOMAIN\Member":
   ensure=>present,
}

resources{'group_member':
   purge =>true,
}

In general, when everything is consistent everything works great. The issue comes in that windows/active directory are not case sensitive. Therefore, when self.instances gets called, It generates a resource Group_member["Users => DOMAIN\SomeGroup"], but in our puppet manifest, Users is hardcoded, DOMAIN comes from a fact, and SomeGroup comes from a hiera value.

We've been fighting with the case sensitivity of puppet for about 5 years on this, and most of our administrators have gotten used to ensuring case matches between domain and yaml configurations.

Now, we have a new problem... somehow DOMAIN is messing up. On a new testing domain, the NETBIOS name is lowercase. The fact we had returning DOMAIN still returns uppercase, but Windows ADSI is returning a lowercase form. This wouldn't be an issue if we wern't using resources{'group_member': purge=>true}, but now in this test environment the groups get added (through their respective .pp files) and removed (through resources{'group_member': purge=>true}}) every puppet run.

Ideally i'd like to just normalize everything to lowercase in self.instances and in all of our .pp files, but we have 400 puppet modules and we use group_member 120 times, managed by quite a few different teams. It would be significantly easier if I could just munge the title metaparameter.

Any suggestions?

edit retag flag offensive close merge delete

Comments

Yes, there is.

Kai Burghardt gravatar imageKai Burghardt ( 2017-12-30 15:54:17 -0500 )edit