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

Group gid fixed as integer #48491

Merged
merged 3 commits into from Jul 10, 2018

Conversation

Projects
None yet
3 participants
@grokrecursion
Contributor

grokrecursion commented Jul 9, 2018

What does this PR do?

Fixes the _changes() function to correctly evaluate the group id.

What issues does this PR fix or reference?

gid was being passed as a string, while the lgrp['gid'] was being passed as an integer.

Added casting or string gid to integer for accurate comparison.

Previous Behavior

The return was false even though the group was successfully created.

New Behavior

This updated code now compares an integer with an integer for the gid.

Tests written?

No

Commits signed with GPG?

No

Previous Error

Evaluation

gid  == <type 'str'>
lgrp['gid'] == <type 'int'>

Output


    [ERROR   ] {'Failed': {'gid': '1030'}}
    local:
    ----------
           ID: oinstall_group
     Function: group.present
        Name: oinstall
      Result: False
      Comment: Group {0} has been created but, some changes could not be applied
     Started: 08:59:43.531683
     Duration: 88.538 ms
     Changes:   
              ----------
              Failed:
                  ----------
                  gid:
                      1030

Fixed Evaluation

Evaluation

    if gid:
       try:
           gid = int(gid)
           if lgrp['gid'] != gid:
                change['gid'] = gid
       except (TypeError, ValueError):
           ret['result'] = False
           ret['comment'] = 'Invalid gid'
           return ret

Changed evaluation from (string != int) to (int != int)

Versions tested

SLES12SP3 / Salt 2016.11.4 (Carbon)
Oracle Linux 7 / Salt 2018.3.1 (Oxygen)

State used for testing:

oinstall_group:
  group.present:
    - name: oinstall
    - gid: '1030'
@grokrecursion

This comment has been minimized.

Contributor

grokrecursion commented Jul 9, 2018

I'm not sure what needs to be fixed to pass tests. Please advise.

@rallytime

This comment has been minimized.

Contributor

rallytime commented Jul 9, 2018

Hi @grokrecursion - we are not accepting bug fixes to the 2017.7.7 branch as that branch has already been released. Can you move this to the 2017.7 branch?

@grokrecursion grokrecursion changed the base branch from 2017.7.7 to 2017.7 Jul 9, 2018

@grokrecursion grokrecursion requested a review from saltstack/team-core as a code owner Jul 9, 2018

@gtmanfred

This will need to be rebased to remove the extra commits from the branch.

@grokrecursion

This comment has been minimized.

Contributor

grokrecursion commented Jul 9, 2018

Tried to rebase on 2017.7. Help! Please advise.

git fetch upstream
git rebase upstream/2017.7 group-fix-v2
git rebase --skip
git push -u origin group-fix-v2 --force 
@gtmanfred

This comment has been minimized.

Contributor

gtmanfred commented Jul 10, 2018

do a git rebase -i HEAD~24 and remove the commits that you are not submitting for your PR.

Then do a git pull --rebase origin 2017.7 to pull anything else down and rebase your changes on top of the HEAD of the 2017.7 branch.

@gtmanfred

This comment has been minimized.

Contributor

gtmanfred commented Jul 10, 2018

I fixed the rebase.

@gtmanfred

This comment has been minimized.

Contributor

gtmanfred commented Jul 10, 2018

Make sure to not force push over this branch, you will need to fix your local branch, and then you can push for anything else that you wanted to change.

@grokrecursion

This comment has been minimized.

Contributor

grokrecursion commented Jul 10, 2018

Thanks @gtmanfred for the help! I only had to add a --force to the push to make it work.

@grokrecursion

This comment has been minimized.

Contributor

grokrecursion commented Jul 10, 2018

Got it, no force. Thanks!

@rallytime rallytime merged commit 5372b60 into saltstack:2017.7 Jul 10, 2018

12 of 16 checks passed

jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #6327 — FAILURE
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #24255 — FAILURE
Details
default Build started sha1 is merged.
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #20380 — RUNNING
Details
WIP ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #26539 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #18573 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #11297 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #23209 — SUCCESS
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment