File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/timezone.cpython-310.pyc
o
�N�g�N � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl
ZddlZddlZddl
ZddlmZ ddlmZmZ e�e�ZdZdd� Zdd � Zd
d� Zdd
� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#d d!� Z$d"d#� Z%d$d%� Z&d&d'� Z'dS )(z5
Module for managing timezone on POSIX-like systems.
� N)�DEFAULT_HASH_TYPE)�CommandExecutionError�SaltInvocationError�timezonec C s$ t jj�� rdS t jj�� rdS tS )z)
Only work on POSIX-like systems
)Fz�The timezone execution module failed to load: win_timezone.py should replace this module on Windows.There was a problem loading win_timezone.py.)Fz�The timezone execution module failed to load: mac_timezone.py should replace this module on macOS.There was a problem loading mac_timezone.py.)�salt�utils�platformZ
is_windowsZ is_darwin�__virtualname__� r
r
�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/timezone.py�__virtual__ s
r c C s8 t d dgdd�} | d dkrd�| d �}t|��| S ) z'
get the output of timedatectl
zcmd.run_all�timedatectlF�Zpython_shell�retcoder ztimedatectl failed: {}�stderr)�__salt__�formatr )�ret�msgr
r
r �_timedatectl1 s
r c C � d} t jj�| d��2}|D ]'}t jj�|�}d|v r4|�d��d�d }|�d�p*d W d � S q
W d � n1 s?w Y t d | ��)
Nz
/etc/TIMEZONE�r�TZ=�
�=����'"�UTC�Unable to get timezone from �
r r �files�fopen�stringutils�
to_unicode�rstrip�split�stripr ��tzfile�fp_�lineZzonepartr
r
r �_get_zone_solaris>