
    Vhe                       d dl mZ dZdZdZd dlmZ d dlmZ	 d dl
mZmZ d dlmZ d d	lmZmZ d d
lmZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZg dZg dZ ej:                  d      Z ej:                  d      Z ej:                  d      Z e G d d             Z!e G d d             Z"d-dZ# ejH                  d      d.d       Z% ejH                  d      d/d       Z& ejH                  d      d0d       Z' ejH                  d      d1d       Z(d2dZ)d3dZ*d4dZ+d5dZ,d6dZ-d7d Z.d7d!Z/d8d"Z0d9d#Z1d7d$Z2d:d%Z3d;d&Z4d<d'Z5d<d(Z6d) Z7d* Z8d+ Z9e:d,k(  r e9        yy)=    )annotationsa  
---
module: mount_facts
version_added: 2.18
short_description: Retrieve mount information.
description:
  - Retrieve information about mounts from preferred sources and filter the results based on the filesystem type and device.
options:
  devices:
    description: A list of fnmatch patterns to filter mounts by the special device or remote file system.
    default: ~
    type: list
    elements: str
  fstypes:
    description: A list of fnmatch patterns to filter mounts by the type of the file system.
    default: ~
    type: list
    elements: str
  sources:
    description:
      - A list of sources used to determine the mounts. Missing file sources (or empty files) are skipped. Repeat sources, including symlinks, are skipped.
      - The C(mount_points) return value contains the first definition found for a mount point.
      - Additional mounts to the same mount point are available from C(aggregate_mounts) (if enabled).
      - By default, mounts are retrieved from all of the standard locations, which have the predefined aliases V(all)/V(static)/V(dynamic).
      - V(all) contains V(dynamic) and V(static).
      - V(dynamic) contains V(/etc/mtab), V(/proc/mounts), V(/etc/mnttab), and the value of O(mount_binary) if it is not None.
        This allows platforms like BSD or AIX, which don't have an equivalent to V(/proc/mounts), to collect the current mounts by default.
        See the O(mount_binary) option to disable the fall back or configure a different executable.
      - V(static) contains V(/etc/fstab), V(/etc/vfstab), and V(/etc/filesystems).
        Note that V(/etc/filesystems) is specific to AIX. The Linux file by this name has a different format/purpose and is ignored.
      - The value of O(mount_binary) can be configured as a source, which will cause it to always execute.
        Depending on the other sources configured, this could be inefficient/redundant.
        For example, if V(/proc/mounts) and V(mount) are listed as O(sources), Linux hosts will retrieve the same mounts twice.
    default: ~
    type: list
    elements: str
  mount_binary:
    description:
      - The O(mount_binary) is used if O(sources) contain the value "mount", or if O(sources) contains a dynamic
        source, and none were found (as can be expected on BSD or AIX hosts).
      - Set to V(null) to stop after no dynamic file source is found instead.
    type: raw
    default: mount
  timeout:
    description:
      - This is the maximum number of seconds to wait for each mount to complete. When this is V(null), wait indefinitely.
      - Configure in conjunction with O(on_timeout) to skip unresponsive mounts.
      - This timeout also applies to the O(mount_binary) command to list mounts.
      - If the module is configured to run during the play's fact gathering stage, set a timeout using module_defaults to prevent a hang (see example).
    type: float
  on_timeout:
    description:
      - The action to take when gathering mount information exceeds O(timeout).
    type: str
    default: error
    choices:
      - error
      - warn
      - ignore
  include_aggregate_mounts:
    description:
      - Whether or not the module should return the C(aggregate_mounts) list in C(ansible_facts).
      - When this is V(null), a warning will be emitted if multiple mounts for the same mount point are found.
    default: ~
    type: bool
extends_documentation_fragment:
  - action_common_attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
  platform:
    platforms: posix
author:
  - Ansible Core Team
  - Sloane Hertel (@s-hertel)
ay  
- name: Get non-local devices
  mount_facts:
    devices: "[!/]*"

- name: Get FUSE subtype mounts
  mount_facts:
    fstypes:
      - "fuse.*"

- name: Get NFS mounts during gather_facts with timeout
  hosts: all
  gather_facts: true
  vars:
    ansible_facts_modules:
      - ansible.builtin.mount_facts
  module_default:
    ansible.builtin.mount_facts:
      timeout: 10
      fstypes:
        - nfs
        - nfs4

- name: Get mounts from a non-default location
  mount_facts:
    sources:
      - /usr/etc/fstab

- name: Get mounts from the mount binary
  mount_facts:
    sources:
      - mount
    mount_binary: /sbin/mount
a
  
ansible_facts:
    description:
      - An ansible_facts dictionary containing a dictionary of C(mount_points) and list of C(aggregate_mounts) when enabled.
      - Each key in C(mount_points) is a mount point, and the value contains mount information (similar to C(ansible_facts["mounts"])).
        Each value also contains the key C(ansible_context), with details about the source and line(s) corresponding to the parsed mount point.
      - When C(aggregate_mounts) are included, the containing dictionaries are the same format as the C(mount_point) values.
    returned: on success
    type: dict
    sample:
      mount_points:
        /proc/sys/fs/binfmt_misc:
          ansible_context:
            source: /proc/mounts
            source_data: "systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=33,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=33850 0 0"
          block_available: 0
          block_size: 4096
          block_total: 0
          block_used: 0
          device: "systemd-1"
          dump: 0
          fstype: "autofs"
          inode_available: 0
          inode_total: 0
          inode_used: 0
          mount: "/proc/sys/fs/binfmt_misc"
          options: "rw,relatime,fd=33,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=33850"
          passno: 0
          size_available: 0
          size_total: 0
          uuid: null
      aggregate_mounts:
        - ansible_context:
            source: /proc/mounts
            source_data: "systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=33,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=33850 0 0"
          block_available: 0
          block_size: 4096
          block_total: 0
          block_used: 0
          device: "systemd-1"
          dump: 0
          fstype: "autofs"
          inode_available: 0
          inode_total: 0
          inode_used: 0
          mount: "/proc/sys/fs/binfmt_misc"
          options: "rw,relatime,fd=33,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=33850"
          passno: 0
          size_available: 0
          size_total: 0
          uuid: null
        - ansible_context:
            source: /proc/mounts
            source_data: "binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0"
          block_available: 0
          block_size: 4096
          block_total: 0
          block_used: 0
          device: binfmt_misc
          dump: 0
          fstype: binfmt_misc
          inode_available: 0
          inode_total: 0
          inode_used: 0
          mount: "/proc/sys/fs/binfmt_misc"
          options: "rw,nosuid,nodev,noexec,relatime"
          passno: 0
          size_available: 0
          size_total: 0
          uuid: null
)AnsibleModule)timeout)get_mount_sizeget_file_content)suppress)astuple	dataclassfnmatchN)z
/etc/fstabz/etc/vfstabz/etc/filesystems)z	/etc/mtabz/proc/mountsz/etc/mnttabzL^(?P<device>\S+) on (?P<mount>\S+) type (?P<fstype>\S+) \((?P<options>.+)\)$z6^(?P<device>\S+) on (?P<mount>\S+) \((?P<fstype>.+)\)$zw^(?P<node>\S*)\s+(?P<mounted>\S+)\s+(?P<mount>\S+)\s+(?P<fstype>\S+)\s+(?P<time>\S+\s+\d+\s+\d+:\d+)\s+(?P<options>.*)$c                  ,    e Zd ZU ded<   ded<   ded<   y)	MountInfostrmount_pointlinezdict[str, str | int]fieldsN__name__
__module____qualname____annotations__     K/home/dcms/DCMS/lib/python3.12/site-packages/ansible/modules/mount_facts.pyr   r      s    
I  r   r   c                  ,    e Zd ZU ded<   ded<   ded<   y)MountInfoOptionsr   r   r   zdict[str, str | dict[str, str]]r   Nr   r   r   r   r   r      s    
I++r   r   c                2    t        j                  dd |       S )Nz(\\[0-7]{3})c                L    t        j                  | j                  d      d      S )Nr   unicode_escape)codecsdecodegroup)ms    r   <lambda>z'replace_octal_escapes.<locals>.<lambda>   s    V]]1771:GW-X r   )resub)values    r   replace_octal_escapesr(      s    66/#XZ_``r   )maxsizec                   d}| j                  d      x}r^|d|g}t        t        j                        5    t	        |       t        j
                        |d| j                  d         }ddd       |S |S # 1 sw Y   |S xY w)zGet device information by UUID.Nblkidz--uuidTr   textr   )get_bin_pathr   
subprocessCalledProcessErrorhandle_timeoutcheck_outputparams)moduleuuidblkid_outputblkid_binarycmds        r   get_device_by_uuidr9      s     L++G444Xt,j334 	}J1>&1*2I2IJ3UYcicpcpqzc{|L	}<	}s   6A66B c                 x    t        t              5  t        j                  d      cddd       S # 1 sw Y   g S xY w)zList UUIDs from the system./dev/disk/by-uuidN)r   OSErroroslistdirr   r   r   list_uuids_linuxr?      s3     
'	 /zz-./ / /Is   /9c                &   d}| j                  d      x}r/|ddddddd	g}t        j                  |d
| j                  d         }|j	                         D cg c]/  }t        |j                               dk(  s |j                         1 c}S c c}w )z%Return device, UUID pairs from lsblk. lsblkz--listz--noheadingsz--pathsz--outputz	NAME,UUIDz	--exclude2Tr   r,      )r.   r/   r2   r3   
splitlineslensplit)r4   lsblk_outputlsblk_binaryr8   r   s        r   	run_lsblkrJ     s     L++G444X~y*k[fhkl!..sv}}U^G_`%1%<%<%>YT#djjlBSWXBXDJJLYYYs   !B9Bc                
   d}| j                  d      x}r-|dddd|g}t        j                  |d| j                  d   	      }d
}|j	                         D ]+  }|j                  d      s|j                  dd      d   } |S  |S )zZFallback to get the device's UUID for lsblk <= 2.23 which doesn't have the --paths option.rA   udevadminfoz--querypropertyz--nameTr   r,   NzID_FS_UUID==   )r.   r/   r2   r3   rE   
startswithrG   )r4   deviceudevadm_outputudevadm_binaryr8   r5   r   s          r   get_udevadm_device_uuidrU     s     N --i888vy*hO#004W`IabD))+ 	 ??=)::c1%a(DK	 Kr   c                @   t               D ]H  }t        j                  j                  t        j                  j	                  d|            }||k(  sF|c S    t        | g       t              |       D ]  \  }}||k(  s|c S    t        |       t              | |      S )z(Get the UUID of a partition by its name.r;   default)r?   r=   pathrealpathjoinr1   rJ   rU   )r4   partnamer5   devs       r   get_partition_uuidr^   "  s     !" ggrww||,?FGs?K C7^FB7	B6J 	Ts?K ;!>&!"9:68LLr   c                      fd}|S )z\Decorator to catch timeout exceptions and handle failing, warning, and ignoring the timeout.c                H     t        j                          fd       }|S )Nc                 .   	  | i |S # t         j                  t        j                  f$ rf}j                  d   dk(  rj                  t        |             n,j                  d   dk(  rj                  t        |             cY d }~S d }~ww xY w)N
on_timeouterrormsgwarn)r/   TimeoutExpired_timeoutTimeoutErrorr3   	fail_jsonr   rf   )argskwargserX   funcr4   s      r   wrapperz2handle_timeout.<locals>.decorator.<locals>.wrapper3  s    T,V,,--x/D/DE ==.'9$$Q$0]]<0F:KKA's    #BAB	BB)	functoolswraps)rn   ro   rX   r4   s   ` r   	decoratorz!handle_timeout.<locals>.decorator2  s%    			 
	 r   r   )r4   rX   rr   s   `` r   r1   r1   0  s     r   c           	        | j                  |d      }	   t        | d      t        j                        |d| j                  d         S # t        j
                  $ r+}| j                  d| dt        |       	       Y d
}~y
d
}~ww xY w)z9Execute the specified mount binary with optional timeout.T)requiredrA   rW   r   r,   zFailed to execute z: rd   N)r.   r1   r/   r2   r3   r0   rj   r   )r4   	mount_binrm   s      r   run_mount_binrv   A  s    ##I#=IIJ1~fb1*2I2IJD&--	*B
 	
 (( I1)Bs1vhGHHIs   6A B
!BB
c                    | j                         }d }t        d |D              rt        }|S t        d |D              rt        }|S t	        |      dkD  rt        d |dd  D              rt
        }|S )Nc              3  F   K   | ]  }t         j                  |        y wN)LINUX_MOUNT_REmatch.0r   s     r   	<genexpr>z$get_mount_pattern.<locals>.<genexpr>O  s     
8$>%
8   !c              3  j   K   | ]+  }|j                  d       rt        j                  |       - yw)zmap N)rQ   BSD_MOUNT_REr{   r|   s     r   r~   z$get_mount_pattern.<locals>.<genexpr>Q  s&     W$tv?V\%Ws   33rD   c              3  F   K   | ]  }t         j                  |        y wry   )AIX_MOUNT_REr{   r|   s     r   r~   z$get_mount_pattern.<locals>.<genexpr>S  s     OT 2 24 8Or   )rE   allrz   r   rF   r   )stdoutlinespatterns      r   get_mount_patternr   L  su    EG

8%
88 
 N	 
W%W	W N 
UaCOU12YOONr   c              #  j  K   t        |       x}sd} | j                         D ]  }|j                  |      x}s|j                         d   }|t        u r|j                         }n|t
        u rh|j                         }t        j                  d|j                  d      d      }t        |      dk(  r	|d   |d<   ne|j                  |d   |d   d       nJ|t        u rB|j                         }|j                  d      }|j                  d	      }|r	|r| d
| }||d<   t        ||        yw)z*List mount dictionaries from mount stdout.rA   mountz\s*,\s*fstyperP   r   )r   optionsmountednode:rR   N)r   rE   r{   	groupdictrz   r   r%   rG   r"   rF   updater   popr   )	r   r   r   r{   r   
mount_infopartsrR   r   s	            r   gen_mounts_from_stdoutr   X  s2    (00G0!!# 1 t,,, !'*n$*J$*JHHZX)>BE5zQ',Qx
8$!!U1X%("KL$*J^^I.F>>&)D$ 66(+#)Jx tZ0051s   D1D3c              #    K   | D ]  }|j                         x}r|j                  d      r'|j                         D cg c]  }t        |       }}|d   |d   |d   |d   d}t	        t
              5  t        |d         |d<   t        |d	         |d
<   ddd       t        |d   ||        yc c}w # 1 sw Y   #xY ww)zYield tuples from /etc/fstab https://man7.org/linux/man-pages/man5/fstab.5.html.

    Each tuple contains the mount point, line of origin, and the dictionary of the parsed line.
    #r   rP   rD      )rR   r   r   r      dump   passnoN)striprQ   rG   r(   r   
IndexErrorintr   )r   r   fieldr   r   s        r   gen_fstab_entriesr   z  s     
  5

$$)=<@JJLI5'.IIQiAYQiay	,

 j! 	2!$VAYJv#&vay>Jx 	2 q	4445 J	2 	2s(   <CB4$C4#B9"C9C	>Cc           	   #  ^  K   | D ]  }|j                         r|j                         j                  d      r3|j                         }|d   }t        t              5  t        |      }ddd       |d   |d   |d   |d   ||d   |d	   d
}t        |d   ||        y# 1 sw Y   :xY ww)zYield tuples from /etc/vfstab https://docs.oracle.com/cd/E36784_01/html/E36882/vfstab-4.html.

    Each tuple contains the mount point, line of origin, and the dictionary of the parsed line.
    r   r   Nr   rP   rD   r   r      )rR   device_to_fsckr   r   r   mount_at_bootr   )r   rQ   rG   r   
ValueErrorr   r   )r   r   r   r   r   s        r   gen_vfstab_entriesr     s     
  5zz|tzz|66s;"1Ij! 	![F	! Qi$QiAYQi#AYay,

 q	444!5
	! 	!s   AB-B!(9B-!B*	&B-c                    g }| D ]s  }|j                  d      s|j                         s%|j                         j                  d      r|j	                  |g       Wd|vrg } |S |d   j	                  |       u |S )zrParse stanzas from /etc/filesystems according to https://www.ibm.com/docs/hu/aix/7.2?topic=files-filesystems-file.*r   rO   )rQ   r   rstripendswithappend)r   stanzasr   s      r   list_aix_filesystems_stanzasr     s~    G 
%??3tzz|;;=!!#&NND6"$N BKt$
% Nr   c              #    K   t        |       D ]  }dj                  |      }|j                  d      dd }i }|D ]8  }|j                  dd      \  }}|j	                         ||j	                         <   : d}|j                  d      x}	r|	}|j                  d	      x}
r|r|d
z  }||
z  }||xs d|j                  d      xs d|d}t        |||        yw)zYield tuples from /etc/filesystems https://www.ibm.com/docs/hu/aix/7.2?topic=files-filesystems-file.

    Each tuple contains the mount point, lines of origin, and the dictionary of the parsed lines.
    
r   Nr   rO   rP   rA   nodenamer]   r   unknownvfs)r   rR   r   
attributes)r   r[   r   rG   r   getr   )r   stanzaoriginalr   r   r   attrr'   rR   r   r]   normalized_fieldss               r   gen_aix_filesystems_entriesr     s    
 /u5 C99V$

1cr"%'
 	5D**S!,KD%',{{}Jtzz|$	5 "z22H2F>>%((C(#cMF )	 nnU+8y$>
 uh0ABB/Cs   CCc           	   #  $  K   t        d | D              st        | D ]o  }|j                         }t        j                  j                  t        |d                |d   |d   |d   |d   t        |d         d}t        |d   ||       q yw)	zYield tuples from /etc/mnttab columns https://docs.oracle.com/cd/E36784_01/html/E36882/mnttab-4.html.

    Each tuple contains the mount point, line of origin, and the dictionary of the parsed line.
    c              3  ^   K   | ]%  }|j                         }t        |d          dk(   ' yw)r   
   N)rG   rF   )r}   r   r   s      r   r~   z%gen_mnttab_entries.<locals>.<genexpr>  s'     STZZ\&s6!9~#Ss   +-r   r   rP   rD   r   )rR   r   r   r   timeN)anyr   rG   datetimedatefromtimestampr   r   )r   r   r   r   s       r   gen_mnttab_entriesr     s     
 SSS 
5##Cq	N3QiAYQiayq	N,

 q	444
5s   BBc              #    K   t        | d      j                         x}rTt        t        t        t
        fD ]:  }t        t        t              5  t         ||            E d{    	 ddd        y yy7 # 1 sw Y   JxY ww)a  Yield parsed mount entries from the first successful generator.

    Generators are tried in the following order to minimize false positives:
    - /etc/vfstab: 7 columns
    - /etc/mnttab: 5 columns (mnttab[4] must contain UNIX timestamp)
    - /etc/fstab: 4-6 columns (fstab[4] is optional and historically 0-9, but can be any int)
    - /etc/filesystems: multi-line, not column-based, and specific to AIX
    rA   N)
r   rE   r   r   r   r   r   r   r   list)filer   
gen_mountss      r   gen_mounts_by_filer     s      "$+66888-/ACTVqr 	J*j1 
  
5 1222 	 	9 3 s0   A
BA6!A4"A6'B4A66A?	;Bc                    g }| j                   d   xs dgD ]_  }|s| j                  d       |dv r|j                  t               |dv r|j                  t               J|dvsO|j                  |       a |S )z6Return a list of filenames from the requested sources.sourcesr   z sources contains an empty stringrd   >   r   dynamic>   r   static>   r   r   r   )r3   rj   extendDYNAMIC_SOURCESSTATIC_SOURCESr   )r4   r   sources      r   get_sourcesr      s    G--	*5ug 
#!CD''NN?+&&NN>*77NN6"
# Nr   c              #  ^  K   t        |       }t        t        |            t        |      k  r| j                  d|        | j                  d   xr t        |      j                  t              }t               }|D ]  }||v s#t        j                  j                  |      x}|v r+|dk(  rP|j                  |       t        | | j                  d         }t        |      D cg c]  }|gt        |       }}n6|j                  |       t        |      D cg c]  }|gt        |       }}|r|dgt        v rd}|E d{     |rHt        | | j                  d         }t        |      D cg c]  }dgt        |       c}E d{    yyc c}w c c}w 7 [c c}w 7 w)ztIterate over the sources and yield tuples containing the source, mount point, source line(s), and the parsed result.zYmount_facts option 'sources' contains duplicate entries, repeat sources will be ignored: mount_binaryr   FN)r   rF   setrf   r3   intersectionr   r=   rY   rZ   addrv   r   r	   r   )	r4   r   mount_fallbackseenr   real_sourcer   r   resultss	            r   gen_mounts_by_sourcer     s    &!G
3w<3w<'opwoxyz]]>2as7|7P7PQ`7aN5D T>RWW-=-=f-EEk$NWHHV"66==+HIFH^_eHfg*5!45gGgHH[!HZ[aHbc*5!45cGcv'!<O!<<"N" vv}}^'DEF\]cFde
W3wz23eee  h d
 	 fesH   C"F-$F:!F-F1F-F$	.F-7F&F-F+F-&F-c           
       
 | j                   d   }g }t        |       D ]A  \  }}}}|d   
|d   d}
j                  d      r%
j                  dd      d   }t	        | |      xs 

t        
fd| j                   d	   xs d
gD              srt        fd| j                   d   xs d
gD              s t        j                  |d| d d      t              }  t        |       |      |      x}	r|j                  |	       |.t        t        j                        5  t        | 
      }ddd       |j                  ||d|d       |j                  |       D |S # 1 sw Y   6xY w)zDList and filter mounts, returning all mounts for each unique source.r   rR   r   NzUUID=rO   rP   c              3  6   K   | ]  }t        |        y wry   r   )r}   r   rR   s     r   r~   z"get_mount_facts.<locals>.<genexpr>@       ]767+]   devicesr   c              3  6   K   | ]  }t        |        y wry   r   )r}   r   r   s     r   r~   z"get_mount_facts.<locals>.<genexpr>B  r   r   fstypesz'Timed out getting mount size for mount z (type ))r   source_data)ansible_contextr5   )r3   r   rQ   rG   r9   r   rh   r   r   r1   r   r   r/   r0   r^   r   )r4   secondsmountsr   r   originr   r5   
timed_func
mount_sizerR   r   s             @@r   get_mount_factsr   1  s   mmI&GF)=f)E %vv!! W%<<Q'*D'5?F]6==;S;\X[W\]]]6==;S;\X[W\]]qX%%g1XY^X__fgmfnno/pq  sA  B
;//
;EBB:BMM*%<*778 :)&&9: 	VF*S]abcf36 M: :s   $E&&E/	c           
        i }i }|D ]9  }|d   }|d   d   }||vr|||<   |j                  |g       j                  |       ; |j                         D ci c])  \  }}t        t	        |            t        |      k7  s'||+ }	}}|	r| j
                  d   |j                         D ci c])  \  }}t        t	        |            t        |      k7  s'||+ }	}}dj                  |	j                         D 
cg c]  \  }}
| d|
 d c}
}      }| j                  d| d	       | j
                  d   r|}||fS g }||fS c c}}w c c}}w c c}
}w )
zkReturn the unique mount points from the complete list of mounts, and handle the optional aggregate results.r   r   r   include_aggregate_mountsz, z (r   z>mount_facts: ignoring repeat mounts in the following sources: ze. You can disable this warning by configuring the 'include_aggregate_mounts' option as True or False.)
setdefaultr   itemsrF   r   r3   r[   rf   )r4   r   mount_pointsmounts_by_sourcer   r   r   srcmntsduplicates_by_src
duplicatesduplicates_straggregate_mountss                r   handle_deduplicationr   S  s   L DGn()(3l*(-L%##FB/66{CD 5E4J4J4LlysDPSTWX\T]P^befjbkPkdllV]]+EFN8H8N8N8Pp93TWX[\`XaTbfijnfoToS$YppSdSjSjSl#mZse2j\$;#mnTUcTd ez z 	{ }}/0! ))) ))) mp#ms   (E?E+(E
E
:E
c                     t        t        ddd      t        dd      t        ddd      t        ddd      t        d	      t        g d
d      t        dd            S )z#Helper returning the argument spec.r   r   N)typeelementsrX   r   raw)rX   r   float)r   )rc   rf   ignorerc   )choicesrX   bool)r   r   r   r   r   rb   r   )dictr   r   r   get_argument_specr  m  sZ    &5$?'6&5$?&5$?'" ;WM!%d!@ r   c                 N   t        t               d      } | j                  d   x}|dk  r| j                  d|        | j                  d   x}%t	        |t
              s| j                  d|        t        |       }t        | |      \  }}| j                  ||d	
       y )NT)argument_specsupports_check_moder   r   z:argument 'timeout' must be a positive number or null, not rd   r   z6argument 'mount_binary' must be a string or null, not )r   r   )ansible_facts)	r   r  r3   rj   
isinstancer   r   r   	exit_json)r4   r   r   r   r   r   s         r   mainr
  z  s    ') F ==++8W\YZaYbcdn55B:VbdgKhUVbUcdeV$F%9&&%I"L"
LVf#ghr   __main__)r'   r   returnr   )r4   r   r5   r   r  
str | None)r  	list[str])r4   r   r  list[list[str]])r4   r   rR   r   r  r  )r4   r   r\   r   r  r  ry   )r4   r   ru   r   r  r   )r   r   )r   r   r  t.Iterable[MountInfo])r   r  r  r  )r   r  r  r  )r   r  r  zt.Iterable[MountInfoOptions])r   r   r  z(t.Iterable[MountInfo | MountInfoOptions])r4   r   r  r  )r4   r   );
__future__r   DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   ansible.module_utils.factsr   rh    ansible.module_utils.facts.utilsr   r   
contextlibr   dataclassesr	   r
   r   r    r   rp   r=   r%   r/   typingtr   r   compilerz   r   r   r   r   r(   	lru_cacher9   r?   rJ   rU   r^   r1   rv   r   r   r   r   r   r   r   r   r   r   r   r   r  r
  r   r   r   r   <module>r     s  
 #M^!FF
P 5 : M  *     	 	  B> klrzzSTrzz  U  V ! ! ! , , ,a T" # T" # T"Z #Z T" #(M"I	1D5,50"C>5(("f@D*4
i  zF r   