Skip to content
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

Fix issue with overly long names in the LGPO module #55823

Merged
merged 10 commits into from
Jan 15, 2020

Conversation

twangboy
Copy link
Contributor

@twangboy twangboy commented Jan 9, 2020

What does this PR do?

Fixes an issue in the LGPO module where policy parameters are extremely long. Some policy names were entire sentences pull from the adml file and prepended to the actual policy name.

This change does not affect ALL policies, only those that had prepended additional text. I estimate that to be 5 to 10 percent of policies. I added some logic to the state that will attempt to replace the old element name with the new element name. If this occurs, a Deprecation warning will be displayed in the comments. The warning will be displayed until Phosphorus.

This PR also replaces smart quotes, smart single quotes, em-dashes, and en-dashes with normal quotes and dashes. The unrecognized characters in the Previous Behavior section below contains smart quotes and an em dash. Those will be replaced and display properly. It will also make it so you don't have to add em dashes and smart quotes when setting policies. You will be able to use standard characters.

Previous Behavior

A recent update to the Windows Update Config policy recently gives us this as a policy setting:

            If you have selected ΓÇ£4 ΓÇô Auto download and schedule the installΓÇ¥ for your scheduled install day and specified a schedule, you also have the option to limit updating to a weekly, bi-weekly or monthly occurrence, using the options below: Every week:
                True

New Behavior

With this PR the above policy setting becomes:

            Every week:
                True

Tests written?

Yes

Commits signed with GPG?

Yes

@twangboy twangboy requested a review from a team as a code owner January 9, 2020 06:26
@ghost ghost requested a review from cmcmarrow January 9, 2020 06:26
@twangboy
Copy link
Contributor Author

twangboy commented Jan 9, 2020

@lomeroe What are your thoughts?

@lomeroe
Copy link
Contributor

lomeroe commented Jan 9, 2020

Some of the "prepended text" unfortunately makes the policy item names make sense (in some cases you'll get the tail end of it only -- I don't remember what policy drove me to add the prepended text, but there are some), that would be the only downside I can come up with off the top of my head.

It looks like prepended text would be cleared if there was a period at the end of it (line 5673). Which was probably for cases similar to this on other policies....Maybe a few other characters should be added, like the colon in your example (or other sentence ending characters) as opposed to dropping it completely...

@twangboy
Copy link
Contributor Author

twangboy commented Jan 9, 2020

Maybe this one:
image
It renders as with old code:

        Network\Offline Files\Configure Slow link speed:
            ----------
            Value entered is [ bps / 100 ] --> Example: 128,000bps, enter 1280 Value:
                640

new code:

        Network\Offline Files\Configure Slow link speed:
            ----------
            Value:
                640

I think I still like the short one

@twangboy
Copy link
Contributor Author

twangboy commented Jan 9, 2020

Here's another one that renders pretty bad:
image

old code:

        Network\Offline Files\Configure slow-link mode:
            ----------
            Allows the administrator to configure when the automatic slow-link transition should happen for the specified UNC paths. The UNC path should be specified in the Value Name colume. The thresholds for throughput (in bits per second) and/or latency (in milliseconds) should be specified in the Value column. Examples: To enable the slow-link mode to apply when network throughput is less than 10000 bits per second and network latency is greater than 50 milliseconds:  Value Name="*" Value="Throughput=10000, Latency=50" To enable the slow-link mode to apply to all shares on a server named "server" when network latency is greater than 50 milliseconds:  Value Name="\\server\*" Value="Latency=50" To enable the slow-link mode to apply to the share named "\\server\share" when network throughput is less than 10000 bits per second:  Value Name="\\server\share\*" Value="Throughput=10000" UNC Paths:
                ----------
                **delvals.:

                \\server\share:
                    Throughput=10000

new code:

        Network\Offline Files\Configure slow-link mode:
            ----------
            UNC Paths:
                ----------
                **delvals.:

                \\server\share:
                    Throughput=10000

@twangboy
Copy link
Contributor Author

twangboy commented Jan 9, 2020

I added back the old code, but commented out so we can test it if we find one that seems like it would benefit from the old code. It includes the dropping prepended_test that ends in either . or :.

@twangboy twangboy force-pushed the fix_lgpo_long_names branch 2 times, most recently from e6f03ac to 84c4fb7 Compare January 10, 2020 00:13
@saltstack saltstack deleted a comment from codecov bot Jan 10, 2020
@saltstack saltstack deleted a comment from codecov bot Jan 10, 2020
@saltstack saltstack deleted a comment from codecov bot Jan 10, 2020
@lomeroe
Copy link
Contributor

lomeroe commented Jan 10, 2020

Yep, agree that the shorter names are easier and maybe items that needed the prepended text is the edge case (I just don't remember what policy element drove that being added -- so we could look at an alternative in those scenarios).

@codecov
Copy link

codecov bot commented Jan 10, 2020

Codecov Report

Merging #55823 into master will decrease coverage by 0.01%.
The diff coverage is 2.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #55823      +/-   ##
==========================================
- Coverage      17%      17%   -<.01%     
==========================================
  Files        1202     1202              
  Lines      224545   224553       +8     
  Branches    49238    49233       -5     
==========================================
  Hits        38153    38153              
- Misses     183523   183530       +7     
- Partials     2869     2870       +1
Flag Coverage Δ
#archlts 16.25% <2.09%> (+0.01%) ⬆️
#centos7 23.77% <ø> (ø) ⬇️
#proxy 23.8% <ø> (ø) ⬇️
#py2 16.84% <2.09%> (+0.01%) ⬆️
#py3 16.7% <2.09%> (ø) ⬇️
#runtests 17% <2.09%> (ø) ⬇️
#ubuntu1604 23.74% <ø> (ø) ⬇️
#zeromq 17% <2.09%> (ø) ⬇️
Impacted Files Coverage Δ
salt/version.py 57.74% <ø> (ø) ⬆️
salt/modules/win_lgpo.py 6.02% <0%> (+0.03%) ⬆️
salt/states/win_lgpo.py 9.59% <2.64%> (-0.48%) ⬇️
salt/config/__init__.py 27.55% <0%> (-0.17%) ⬇️
salt/states/file.py 5.09% <0%> (ø) ⬇️
salt/modules/postgres.py 13.83% <0%> (ø) ⬆️
salt/utils/nacl.py 19.68% <0%> (+0.86%) ⬆️

@twangboy twangboy added the ZRELEASED - Neon retired label label Jan 11, 2020
salt/modules/win_lgpo.py Outdated Show resolved Hide resolved
@twangboy twangboy force-pushed the fix_lgpo_long_names branch 2 times, most recently from f093ef8 to 15cca69 Compare January 13, 2020 18:47
@dwoz dwoz merged commit d0150d8 into saltstack:master Jan 15, 2020
@twangboy twangboy deleted the fix_lgpo_long_names branch May 26, 2020 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ZRELEASED - Neon retired label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants