3
À<×eS ã @ s> d dl Z d dlZddlmZ d dlmZ G dd„ dejƒZdS )é Né )Úbase)Úcommandsc s, e Zd ZdZ‡ fdd„Z‡ fdd„Z‡ ZS )Ú
virt_checkz§
Checks whether running inside virtual machine (VM) or on bare metal.
If running inside VM expands to argument 1, otherwise expands to
argument 2 (even on error).
c s t t| ƒjdddƒ d S )Nr é )Úsuperr Ú__init__)Úself)Ú __class__© ú)/usr/lib/python3.6/function_virt_check.pyr s zvirt_check.__init__c sJ t t| ƒj|ƒsd S | jjdgƒ\}}|dkrBt|ƒdkrB|d S |d S )Nz virt-whatr r )r r ÚexecuteZ_cmdÚlen)r ÚargsÚretÚout)r
r r r
s zvirt_check.execute)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r
Ú
__classcell__r r )r
r r s r ) ÚosZ
tuned.logsZtunedÚ r Ztuned.utils.commandsr ZFunctionr r r r r Ú