-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xSQLServer: Resource Naming Conventions #851
Comments
If someone else has an opinion on this, then please share. Me personally think @randomnote1's suggestion is all positive. The only minor negative is that 'SQL' does not accurately describe the SQL Server product, but could be any other SQL product, potentially colliding/conflicting with that products name. But most likely both those products are not installed on the same target node, so conflict with two, for example, SQLSetup resource are really low. So, a minor negative 😄 To enforce this guideline on present resources will be a major breaking change. The specific contribution guidelines in this repository would be a good place for describing this naming convention. I think we also should consider resolving issue #308 when we do such a breaking change. And add that to the naming convention as well. |
@randomnote1 I think the example 'SQLAlwaysOnDatabaseMembership' is wrong? Shouldn't be 'SQLAvailabilityGroupDatabaseMembership'? Maybe it could even be shortened to 'SQLAvailabilityGroupDatabase'? Would you mind adding a list of current name and new name to your issue description (or new comment)? |
@johlju, you are completely correct! Fixed my example above. I'll work on building out a table translating current resource names to proposed resource names. I thought about that with "competing" SQL products, however others tend not to have "SQL" in the name except for MySQL. Though, in that example, I would expect the DSC module would start with "MySQL". |
Thanks for adding the list of resource and also making notes on them! Awesome! In regards of your suggestion to skip 'x' from the resource names. I did talk with @mgreenegit at MSIgnite and he suggested to skip the 'x' when I mentioned a new resource was in the pipe (xSQLServerDefaultLocation). He also had a thought, emphasis on thought (might not happen in this way), that maybe there could be a new branch which would be a "SqlServerDsc"-branch and published to the gallery. But today, in the the CONTRIBUTING.md in DscResources it says
So for this issue I think we must assume we can't rename the resources to not use 'x' as long as the module is still named 'xSQLServer'. |
This is good stuff! I read through the PR for updating the naming guidance. I think dropping the "x" on the resource name is an excellent idea so we can seamlessly move resources from dev to experimental and then eventually supported. I think the guidance for working around the conflicts of using same resource names in all of the branches would look something like this:
Once the conversation in the contributing guidance is completed, then we should be able to finalize the decision here. |
Good stuff here @randomnote1! Couple of notes/comments:
|
Agree with @nabrond on that 'Sql' should be used. Scope is an interesting idea. For example setting permission for Analysis Services, how would that resource be named?
The last would align with the proposed name for 'xSQLServerRSConfig'; 'SqlRS'. |
I like the idea of scope. How would we handle items that are outside of the SQL instance? I'm think of things like the AlwaysOn service, aliases, network configuration, etc. Would they fall under the server scope? Instead of For Analysis Services (and other components), I am leaning towards using the acronym with the module identifier ( I updated the table with the scope concept. There are several items that need refined. |
I think they need to fall under server scope. I do like 'Instance', but I think it would be confusing. Yes I think 'SqlASPermission' is the best option. We should not use long names again. :) |
In issue description there is "Feature Property" in the list. Maybe that should be renamed to "Scope property" instead? I thought of yet another idea. It builds on the discussion but changes the formula a bit.
That would make resource name like this. SqlSetup |
I would like to submit a PR asap to resolve Issue 713. The root cause of that issue is actually the length of the AlwaysOnAvailabilityGroupDatabaseMembership resource. If I am going to request a breaking change, I would like to minimize churn and risk of a rename happening twice. I will get a PR rolling with the naming conventions from the top of this page. If there are any objections, please feel welcome to make comments in the PR and I can update accordingly. cc @kwirkykat |
@mgreenegit go ahead with the PR. @randomnote1 (and others) my last comment with the idea of using the component abbreviation in the naming convention, what is your thought? Should we discard the idea? |
@johlju, I'm struggling with the same thing about the pascal case of the component suggestion. Can we drop The other option is to change @nabrond, can you weigh in? |
@mgreenegit, @johlju |
I’m okay with dropping the ‘DBE’ from the list, I agree that resources without an” component abbreviation would be assumed to belong to Database Engine. If we are going with component abbreviation should we write Analysis Services with the abbreviation ‘As’ (pascal case)? making a resource name look like ‘SqlAsPermisson’, and for Reporting Services use ‘Rs’, making a resource band look like ‘SqlRs’ @randomnote1 in the end I’m good either way, so I suggest you decide, and I will agree with whatever combination you choose of these options. Because I don’t think we can get it absolutely perfect 😄 If we get more opinions or ideas we take it up for discussion again. |
I agree with @randomnote1, not a huge fan of |
@randomnote1 there is an issue in either DscResources or DscResources.Tests that we need to get a Tests for the hard limit for path’s (not sure it’s needed though). But if there is a hard limit for resource names we absolutely need a common test for that. |
@johlju, @nabrond, @mgreenegit I will update the template in the first comment with the suggested naming scheme. For two character abbreviations, I'll stick with uppercase letters per @nabrond's earlier suggestion. |
Sounds great! Thanks @RandomNote! |
@johlju, @nabrond, @mgreenegit The suggestion table at the top is updated. I ran through it pretty quickly, so please let me know if I made any mistakes. Thanks! |
Could I ask someone to please take a look at this so far? Pester is returning the same error for every resource and I'm having trouble figuring out where the error is coming from. This assumes the goal would be to rename the module to SqlServerDSC, and that since it is a breaking change it would become version 9.0.0. I wasn't sure if that was in scope or not. @randomnote1 for now, 129 chars |
@mgreenegit Poked around a little bit with your branch tonight. I found some issues where There also seems to be an oddity in |
Dumb question here. When @mgreenegit's PR is merged and the resource is renamed, will we rename the repository? Or will we create a new repo? Not particularly sure how this works with such a major change. |
A lot of things to comment on here. One at the time below... @mgreenegit Running your code both locally and in AppVeyor. Will see if I can see whats going on. @mgreenegit renaming the resource to 'SqlServerDsc' was in scope, but we was waiting for the discussion about the naming convention to be concluded and the new guidelines merged i DscResources. 😄 @mgreenegit I think we should name the resource 'SqlServerDsc' (pascal case) to align with all other resource modules. @mgreenegit 129 chars limit, is that for the full path length? Because it cannot be limit of resource name, then we didn't need to rename the resources. :) @randomnote1 and @mgreenegit For the common test to work (without reworking one or two common tests in DscResource.Tests), either the repository need to be renamed, or create a new repository, with the same name as the .psd1 file has. |
@nabrond I have seen that issue... Think it had something to do with hash tables being used wrongly (not cloned?) which is caught in PowerShell prompt, but not in debugger because of different scopes. I have fixed it in some resources, but a long time ago, so I don't remember exactly what caused it. Update 2: I have sent in a PR fixing this. Update: This block is the problem in the below code. Before this block
Changing the block to this resolves the problem.
|
@mgreenegit I ran the code in AppVeyor. There are errors but can't see those you were mentioning. See all errors here:
|
This is awesome collaboration. I will make these changes ASAP. The naming is in line with what I am proposing for the new guidelines (also hoping to get done ASAP). I will present my proposal next week on the community call for feedback and/or consensus. The 129 char limit is fullname (path) per file. We hope that limit is going to be temporary but can be used as a guide in the short term. |
@mgreenegit I updated the issue PowerShell/DscResource.Tests#188 with a link to the above comment regarding the limit. |
Looks like we have a good build. I will submit a PR for review and discussion. Note I temporarily renamed my fork during testing. |
@mgreenegit @randomnote1 I saw a thing in the above list. SqlAGDatabases is written as plural. Should we change that to SqlAGDatabase so it is singular as the rest? I suggest we do that in PR #902. |
@randomnote1 and @nabrond can I please get your opinion of the above comment - renaming 'SqlAGDatabases' to 'SqlAGDatabase' (singular). Did we have a reason for naming it using plural? |
Sorry...I totally forgot to respond to your initial question! I'm ok with using the singular |
+1 for singular. Although I understand the point @randomnote1 is making about it potentially managing multiple databases. Maybe we need to take a look at the SqlAG resources as a whole and redesign? That's a discussion for another issue though. |
Updated the table above and will add a review comment asking if we can do this change in PR #902. |
Thank you everyone for assisting me with this effort. |
This commit handles the rename of the DSC Resource to by moving the contents of the xSQLServer folder to a folder named SqlServerDSC. In PR dsccommunity/SqlServerDsc#851 the xSQLServer DSC Resource was renamed from xSQLServer to SqlServerDsc. This normally wouldn't be a problem, however when they changed the name they updated the xSQLServer submodule to point to the commit in the newly renamed SqlServerDsc repo. Since we do a direct git submodule update, it uses the folder name of the submodule reference (xSQLServer) and not the name of the target repo (SqlServerDSC), resulting in a folder called xSQLServer with all the contents of the SqlServerDsc repo. The simple short term fix is to move in place the folder to the correct name. The longer term fix is stop using the powershell/dscresources git repo as a source of truth, which is part of a larger project that is planned. This is hardcoded and done in a single line right now because premature optimization is the root of all evil. While we can predict there will be more renamed cases (https://blogs.msdn.microsoft.com/powershell/2017/12/08/dsc-resource-naming-and-support-guidelines/) there is no telling where things will land until we see how people migrate their DSC Resources forward. This is also largely a moot point when we move to the PowerShell parser approach.
This commit handles the rename of the DSC Resource to by moving the contents of the xSQLServer folder to a folder named SqlServerDSC. In PR dsccommunity/SqlServerDsc#851 the xSQLServer DSC Resource was renamed from xSQLServer to SqlServerDsc. This normally wouldn't be a problem, however when they changed the name they updated the xSQLServer submodule to point to the commit in the newly renamed SqlServerDsc repo. Since we do a direct git submodule update, it uses the folder name of the submodule reference (xSQLServer) and not the name of the target repo (SqlServerDSC), resulting in a folder called xSQLServer with all the contents of the SqlServerDsc repo. The simple short term fix is to move in place the folder to the correct name. The longer term fix is stop using the powershell/dscresources git repo as a source of truth, which is part of a larger project that is planned. This is hardcoded and done in a single line right now because premature optimization is the root of all evil. While we can predict there will be more renamed cases (https://blogs.msdn.microsoft.com/powershell/2017/12/08/dsc-resource-naming-and-support-guidelines/) there is no telling where things will land until we see how people migrate their DSC Resources forward. This is also largely a moot point when we move to the PowerShell parser approach.
A common theme I've been reading in the issues is that the names of the resources in the xSQLServer module are too long. Even if they worked with Azure Automation, they are considered to be too long. With that said, some of the names are extremely long due to the naming conventions that have been adopted (eg. xSQLServerAlwaysOnAvailabilityGroupDatabaseMembership).
The basic format of the naming convention appears to be:
<Module Identifier>[<Component>][<Action>]<Scope>{<Feature> | <Property>}
If we could publish guidance on what our naming convention is for each item, I think it could result in shorter name lengths. This published guidance would be part of the contributing guidelines. For example:
Here's a table with the current resource names and proposed resource names:
I'm looking forward to hearing your thoughts on this.
The text was updated successfully, but these errors were encountered: