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

Remove fstab features from mount, call new module mount2 #27174

Closed
wants to merge 1 commit into from
Closed

Remove fstab features from mount, call new module mount2 #27174

wants to merge 1 commit into from

Conversation

Jmainguy
Copy link
Contributor

@Jmainguy Jmainguy commented Jul 21, 2017

SUMMARY
ISSUE TYPE
  • Feature Pull Request
  • New Module Pull Request
COMPONENT NAME

lib/ansible/modules/system/mount2.py

ANSIBLE VERSION

Latest Devel

ADDITIONAL INFORMATION

See issue #19820 where discussion on splitting module started

@ansibot
Copy link
Contributor

ansibot commented Jul 21, 2017

@Jmainguy this PR contains more than one new module.

Please submit only one new module per pullrequest. For further explanation, please read grouped module documentation

click here for bot help

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 feature_pull_request module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. new_module This PR includes a new module. support:community This issue/PR relates to code supported by the Ansible community. labels Jul 21, 2017
@Jmainguy
Copy link
Contributor Author

mount2 just deals with the mount command and will not check fstab.
fstab module just deals with fstab and will not check what is and is not already mounted.

Limitations present in this solution.
For someone to have a mount persist and mount at playbook runtime, they would need to run 2 tasks at a minimum, either fstab module, followed by mount2, or fstab module, followed by shell module calling mount -a.

@bcoca
Copy link
Member

bcoca commented Jul 21, 2017

I would consider it the same way we 'install/configure' services and then call handler, in this case, fstab is configuration, mount2 the 'handler' (only if you want to, it seems like a good way but this is not a mandate).

@bcoca
Copy link
Member

bcoca commented Jul 21, 2017

@Jmainguy could you split into 2 PRs, we normally prefer PR per new module to be able to review in parallel.

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Jul 21, 2017
@ansibot
Copy link
Contributor

ansibot commented Jul 21, 2017

The test ansible-test sanity --test pep8 failed with the following errors:

lib/ansible/modules/system/mount2.py:126:23: E226 missing whitespace around arithmetic operator
lib/ansible/modules/system/mount2.py:140:23: E226 missing whitespace around arithmetic operator

The test ansible-test sanity --test validate-modules failed with the following errors:

lib/ansible/modules/system/fstab.py:0:0: E312 No RETURN provided
lib/ansible/modules/system/mount2.py:0:0: E312 No RETURN provided

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. and removed ci_verified Changes made in this PR are causing tests to fail. labels Jul 21, 2017
@Jmainguy
Copy link
Contributor Author

I will split this into two PR's to fit the model

@ansibot
Copy link
Contributor

ansibot commented Jul 21, 2017

The test ansible-test sanity --test pep8 failed with the following errors:

lib/ansible/modules/system/mount2.py:126:23: E226 missing whitespace around arithmetic operator
lib/ansible/modules/system/mount2.py:140:23: E226 missing whitespace around arithmetic operator

The test ansible-test sanity --test validate-modules failed with the following errors:

lib/ansible/modules/system/fstab.py:0:0: E312 No RETURN provided
lib/ansible/modules/system/mount2.py:0:0: E312 No RETURN provided

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Jul 21, 2017
@Jmainguy Jmainguy changed the title Split mount into mount2 and fstab modules Remove fstab features from mount, call new module mount2 Jul 24, 2017
@Jmainguy
Copy link
Contributor Author

Split it out, fstab is now in #27245

@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Jul 24, 2017
@ansibot
Copy link
Contributor

ansibot commented Jul 24, 2017

@AugustusKling @ColOfAbRiX @DavidWittman @EvanK @LinusU @abulimov @adejoux @agaffney @ahtik @Akasurde @azaghal @dankeder @davixx @dougluce @dsummersl @goozbach @groks @jasperla @jhoekx @jsumners @kevensen @lberruti @matze @maxamillion @mcv21 @molekuul @mpdehaan @mulby @natefoo @nibalizer @ovcharenko @pmarkham @pyykkis @risaacson @rosmo @saito-hideki @sfromm @srvg @tdtrask @tmshn @xen0l

As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add shipit if you would like to see it merged.

click here for bot help

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jul 24, 2017
@mscherer
Copy link
Contributor

Do we really need to call it 'mount2' ? I suspect that we would maybe need a better way to deprecate 'mount', and I suspect this would create a lot of confusion to people over using 'mount' or 'mount2'

#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2012, Red Hat, inc
Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright should be updated (that's a detail)

description:
- Filesystem type. Required when I(state) is C(mounted).
required: false
default: null
Copy link
Contributor

Choose a reason for hiding this comment

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

Would using 'auto' here permit to not specifiy it ?

Copy link
Member

Choose a reason for hiding this comment

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

I would default to 'auto' and not require it, let the command fail if it is not present in fstab (like mount does)

try:
os.makedirs(path)
except (OSError, IOError):
e = get_exception()
Copy link
Contributor

Choose a reason for hiding this comment

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

As we no longer care about 2.4, I think this can be cleaned

- If specifying C(mounted) and the mount point is not present, the mount
point will be created.
required: true
choices: ["mounted", "unmounted"]
Copy link
Member

Choose a reason for hiding this comment

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

I would add 'fstab' option to let user specify a specific fstab file, using the system default otherwise

- If specifying C(mounted) and the mount point is not present, the mount
point will be created.
required: true
choices: ["mounted", "unmounted"]
Copy link
Member

Choose a reason for hiding this comment

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

present/absent could be used here, just to keep it in line with other 'state' fields

@RainerW
Copy link

RainerW commented Jul 27, 2017

As said in #19820 separating mount and fstab makes ansible too verbose :

- name: Mount for Access now
  mount2:
    path: /home
    src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
    fstype: xfs
    opts: noatime
    state: present

- name: make Mount persistent
  fstab:
    path: /home
    src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
    fstype: xfs
    opts: noatime
    state: present

vs

- name: Mount shared filesystem
  mount:
    path: /home
    src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
    fstype: xfs
    opts: noatime
    state: present
    fstab: present

@bcoca
Copy link
Member

bcoca commented Jul 28, 2017

@RainerW only if you force module to always define all parameters, it should be able use existing entries in fstab to avoid this, but it should work both ways.

- name: make Mount persistent
  fstab:
    path: /home
    src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
    fstype: xfs
    opts: noatime
    state: present

- name: Mount for Access now
  mount2:  path=/home  state=present

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 2, 2017
@ltalirz
Copy link

ltalirz commented Nov 8, 2017

+1
To me, the fact that the mount module would better be split into two is also reflected in the current way of "undoing" a state: mounted.
If I understand the manual correctly, I have to

  1. call mount with state: unmounted to unmount the file system
  2. call mount again with state: absent to remove the fstab entry

There are simply two "states" at play here

@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansible ansible deleted a comment from ansibot Nov 16, 2017
@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_pull_request labels Mar 2, 2018
@ansibot ansibot added the new_plugin This PR includes a new plugin. label May 22, 2018
@ansibot ansibot added the system System category label Feb 17, 2019
@ansibot ansibot added collection Related to Ansible Collections work collection:community.general needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@darkdragon-001
Copy link

Any progress on this?

@ansibot
Copy link
Contributor

ansibot commented Aug 17, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this Aug 17, 2020
@ansible ansible locked and limited conversation to collaborators Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bot_closed collection:community.general collection Related to Ansible Collections work community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. has_issue module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md new_module This PR includes a new module. new_plugin This PR includes a new plugin. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants