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(install): replace gid_from_name (deprecated in develop) #40

Merged
merged 4 commits into from
Jul 20, 2020

Conversation

ShaunMaher
Copy link

@ShaunMaher ShaunMaher commented Jul 16, 2020

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Close #39

Describe the changes you're proposing

Remove use of the deprecated "gid_from_name" property of user.present.

Pillar / config required to test the proposed changes

An existing working pillar should continue to work unmodified.

Debug log showing how the proposed changes work

I'm not sure how to do this, sorry.

Documentation checklist

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

I'm not sure how to do this, sorry.

Additional context

@pull-assistant
Copy link

pull-assistant bot commented Jul 16, 2020

Score: 1.00

Best reviewed: commit by commit


Optimal code review plan

     fix(install): replace gid_from_name (deprecated in develop)

     Update install.sls

     Update systemd.service.jinja

     Update install.sls

Powered by Pull Assistant. Last update 127db73 ... 574775e. Read the comment docs.

@ShaunMaher
Copy link
Author

Hi.

I don't think the build failures are because of anything I have changed but this is entirely new to me. Would anyone be able to look over the build log and, if it is me that has made an error, give me a hint?

Thanks
Shaun.

etcd/install.sls Outdated
Comment on lines 12 to 16
group.present:
- name: {{ etcd.group or 'etcd' }}
- system: True
- require_in:
- user: etcd-user-group-home
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this section being removed? I don't use this formula so I can't be sure if this should be done or not. If it should be, then it would be worth mentioning the rationale in the PR's main comment, so that future developers can understand what the thought process was.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group is referenced here:

- group: {{ etcd.group or 'etcd' }}

@myii
Copy link
Member

myii commented Jul 17, 2020

Thanks for preparing this PR, @ShaunMaher.

I don't think the build failures are because of anything I have changed but this is entirely new to me. Would anyone be able to look over the build log and, if it is me that has made an error, give me a hint?

Many of our formulas have well-maintained CI in place but no-one has got around to fixing things in this formula yet. Let's not worry about it too much right now. Once we're happy with the changes (see my inline comment), we won't let that get in the way of getting this merged.

@noelmcloughlin
Copy link
Member

noelmcloughlin commented Jul 17, 2020

Hi @ShaunMaher I see myii is reviewing.

I just noticed a preexising bug

Would you mind setting User=etcd in this file:
I think etcd should run non-privileged.
I checked and found a blog with User=etcd too: https://www.sma.im/install-etcd-as-systemd-service-on-ubuntu-server/

@myii
Copy link
Member

myii commented Jul 17, 2020

@noelmcloughlin user is available in the map:

Should that be repurposed to be used in the template?

@noelmcloughlin
Copy link
Member

Should that be repurposed to be used in the template?

That makes sense - I have not looked at this formula in a long time - just noticed the PR in passing. Looks like CI needs work

@noelmcloughlin
Copy link
Member

Should that be repurposed to be used in the template?

That makes sense - I have not looked at this formula in a long time - just noticed the PR in passing. Looks like CI needs work

Group is in the map too.

etcd/install.sls Outdated
user.present:
- name: {{ etcd.user or 'etcd' }}
- gid_from_name: True
- gid: {{ etcd.user or 'etcd' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on @noelmcloughlin's comment, it looks like this should be:

Suggested change
- gid: {{ etcd.user or 'etcd' }}
- gid: {{ etcd.group or 'etcd' }}

@noelmcloughlin
Copy link
Member

noelmcloughlin commented Jul 17, 2020 via email

@ShaunMaher
Copy link
Author

Hi.

Sorry about the delay.

Thank you everyone for the feedback. I have made a couple of new changes, hopefully satisfying everyone.

@noelmcloughlin, according to the saltstack doco, gid doesn't have to be numeric: "The id of the default group to assign to the user. Either a group name or gid can be used. If not ..." (https://docs.saltstack.com/en/latest/ref/states/all/salt.states.user.html)

@myii, regarding "etcd.group" I agree, updated PR to reflect this change.

@myii, regarding the systemd unit template, I have included a fix. I have also wrapped User= and Group= lines in {%- if etcd.manage_users %} to match what is in install.sls.

Cheers.
Shaun.

@myii
Copy link
Member

myii commented Jul 20, 2020

@ShaunMaher Thanks for making the changes. There's still this to be resolved either way: #40 (comment).

@noelmcloughlin
Copy link
Member

Thanks @ShaunMaher

If we use group for gid then need to ensure group exists or was created before assigning gid:

@ShaunMaher
Copy link
Author

Ok, yep. I was assuming that specifying a gid that didn't exist would have salt create the group. Never assume.

I'll restore "group.present" and the spots that included it as a require.

@ShaunMaher
Copy link
Author

Ok. How about that?

Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working through this.

@myii myii merged commit 9603903 into saltstack-formulas:master Jul 20, 2020
@myii
Copy link
Member

myii commented Jul 20, 2020

@ShaunMaher Nice work, that's been merged.

@noelmcloughlin
Copy link
Member

Thanks @ShaunMaher great cooperation and response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] 'gid_from_name' is an invalid keyword argument for 'user.present'
3 participants