File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/mac_assistive.cpython-310.pyc
Back
o ;j7 � @ s� d Z ddlZddlZddlZddlZddlZddlZddlm Z ddl mZ e�e �ZdZddiZdZd d � Zddd�Zdd� Zddd�Zdd� Zdd� ZG dd� d�ZdS )z� This module allows you to manage assistive access on macOS minions with 10.9+ .. versionadded:: 2016.3.0 .. code-block:: bash salt '*' assistive.install /usr/bin/osascript � N)�CommandExecutionError)�VersionZ assistive�enable_�enablez1/Library/Application Support/com.apple.TCC/TCC.dbc C s, t jj�� sdS ttd �td�k rdS tS )z Only work on Mac OS )FzMust be run on macOSZ osreleasez10.9)Fz"Must be run on macOS 10.9 or newer)�salt�utils�platformZ is_darwinr Z __grains__�__virtualname__� r r �N/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/mac_assistive.py�__virtual__ s r T� � c C s� d} t � �N}z|j| |d�W W d � S tjyL } z)dt|�vr/td| � d|� ���||k r8|d7 }n td| � d|� ���W Y d}~nd}~ww W d � n1 sWw Y t�|� q)a= Install a bundle ID or command as being allowed to use assistive access. app_id The bundle ID or command to install for assistive access. enabled Sets enabled or disabled status. Default is ``True``. tries How many times to try and write to a read-only tcc. Default is ``True``. wait Number of seconds to wait between tries. Default is ``10``. CLI Example: .. code-block:: bash salt '*' assistive.install /usr/bin/osascript salt '*' assistive.install com.smileonmymac.textexpander � T)r Nz$attempt to write a readonly databasezError installing app(�): )�TccDB�install�sqlite3�Error�strr �time�sleep)�app_idr Ztries�waitZ num_tries�db�excr r r r ( s. �� ����� �r c C �f t � �&}z |�| �W W d � S tjy( } z td| � d|� ���d}~ww 1 s,w Y dS )ah Check if a bundle ID or command is listed in assistive access. This will not check to see if it's enabled. app_id The bundle ID or command to check installed status. CLI Example: .. code-block:: bash salt '*' assistive.installed /usr/bin/osascript salt '*' assistive.installed com.smileonmymac.textexpander N�Error checking if app(z) is installed: )r � installedr r r �r r r r r r r S � �����r c C s� t � �8}z|r|�| �W W d � S |�| �W W d � S tjy: } z td|� d| � d|� ���d}~ww 1 s>w Y dS )a� Enable or disable an existing assistive access application. app_id The bundle ID or command to set assistive access status. enabled Sets enabled or disabled status. Default is ``True``. CLI Example: .. code-block:: bash salt '*' assistive.enable /usr/bin/osascript salt '*' assistive.enable com.smileonmymac.textexpander enabled=False NzError setting enable to z on app(r )r r �disabler r r )r �enabledr r r r r r k s � �����c C r )aN Check if a bundle ID or command is listed in assistive access and enabled. app_id The bundle ID or command to retrieve assistive access status. CLI Example: .. code-block:: bash salt '*' assistive.enabled /usr/bin/osascript salt '*' assistive.enabled com.smileonmymac.textexpander Nr z) is enabled: )r r"