Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@yonas
Copy link
Contributor

@yonas yonas commented Sep 1, 2024

I'm submitting a

  • bug fix
  • feature
  • documentation addition

What is the current behaviour?

Action user.add fails if the user already exists.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

actions:
  - action: user.add
    fullname: Test User
    home_dir: /home/test
    username: test
    shell: /bin/sh

What is the expected behavior?

Pass without fail if user already exists.

What is the motivation / use case for changing the behavior?

Should not be marked as a failing result.

Please tell us about your environment:

Version (comtrya --version): ccdf5e1
Operating system: FreeBSD 14

@yonas yonas changed the title Detect if users already exists instead of failing. Detect if users already exists instead of failing. Fixes #431 Sep 1, 2024
@yonas yonas force-pushed the yonas-patch-user-exists branch from 00ad684 to 8c54049 Compare September 1, 2024 13:15
Copy link
Member

@martintc martintc left a comment

Choose a reason for hiding this comment

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

Just a single comment regarding adding a conditional compilation guard for use of the uzers crate.

@yonas yonas force-pushed the yonas-patch-user-exists branch from 40de1ba to f0930cd Compare September 1, 2024 19:40
@yonas yonas requested a review from martintc September 1, 2024 19:43
@yonas
Copy link
Contributor Author

yonas commented Sep 1, 2024

Wait, it needs to add the variant for Windows.

Edit: Done.

@yonas yonas force-pushed the yonas-patch-user-exists branch from f0930cd to 742204e Compare September 1, 2024 19:46
@martintc
Copy link
Member

martintc commented Sep 1, 2024

I think one last thing, run cargo fmt so it'll pass the linter. Also looks like just a couple missing semi-colons.

@yonas yonas force-pushed the yonas-patch-user-exists branch from 742204e to c006187 Compare September 1, 2024 23:09
@codecov-commenter
Copy link

codecov-commenter commented Sep 1, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 27.07%. Comparing base (b574682) to head (a587faa).
Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/actions/user/add.rs 0.00% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #453      +/-   ##
==========================================
- Coverage   28.59%   27.07%   -1.53%     
==========================================
  Files          85       83       -2     
  Lines        2301     2246      -55     
==========================================
- Hits          658      608      -50     
+ Misses       1643     1638       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yonas yonas force-pushed the yonas-patch-user-exists branch from c006187 to a587faa Compare September 2, 2024 00:14
@yonas
Copy link
Contributor Author

yonas commented Sep 2, 2024

Added conditional check when importing tracing::debug.

@martintc martintc merged commit b06e172 into comtrya:main Sep 2, 2024
@martintc
Copy link
Member

martintc commented Sep 2, 2024

Looks like it is good to go, thank you!

Addition: Just noticed that this looks like its your first commit! Congrats and thank you once again!

@yonas yonas deleted the yonas-patch-user-exists branch September 2, 2024 09:36
@yonas
Copy link
Contributor Author

yonas commented Sep 2, 2024

Yay! Thanks @martintc !

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.

3 participants