MOON
Server: Apache
System: Linux server2.shieldcogroup.com 3.10.0-1160.119.1.el7.tuxcare.els12.x86_64 #1 SMP Fri Nov 8 05:49:38 UTC 2024 x86_64
User: jacom (1029)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python2.7/site-packages/leapp/cli/commands/command_utils.pyc
�
��ic@sddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZdZ
dZdZdZd	Zd
Zejd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Ze�d�Zd�Zd�Zd�Zd�Z dS(i����N(tconfig(tCommandError(taudittpaths/hana/sharedsexe/linuxx86_64/hdb/sapcontrolsexe/linuxppc64le/hdb/sapcontroltdefaulttsaphanasupgrade_paths.jsons^([1-9]\d*)(\.(\d+))?$cCs7tjt|�s*tdj|���n|jd�S(s�
    Versioning schema: MAJOR.MINOR
    In case version contains an invalid version string, an CommandError will be raised.

    :raises: CommandError
    :return: release tuple
    s'Unexpected format of target version: {}t.(tretmatcht
VERSION_REGEXRtformattsplit(tversion((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pyt
check_versionscCstt|�d�S(s
    Return the major version from the given version string.

    Versioning schema: MAJOR.MINOR.PATCH

    :param str version: The version string according to the versioning schema described.
    :rtype: str
    :returns: The major version from the given version string.
    i(tstrR
(R((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_major_version#s
cCs�tjjt�r�xrtjt�D]^}tjjtjjt|t��}tjjtjjt|t��}|s||r"tSq"Wnt	S(s]
    Detect SAP HANA based on existence of /hana/shared/*/exe/linuxx86_64/hdb/sapcontrol
    (
tosRtexiststHANA_BASE_PATHtlistdirtjointHANA_SAPCONTROL_PATH_X86_64tHANA_SAPCONTROL_PATH_PPC64LEtTruetFalse(tentrytsap_on_inteltsap_on_power((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytdetect_sap_hana0s$$cCst�r
tStS(s=
    Returns the flavour of the upgrade for this system.
    (RtLEAPP_UPGRADE_FLAVOUR_SAP_HANAtLEAPP_UPGRADE_FLAVOUR_DEFAULT(((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_upgrade_flavour>s	cCsNt|��<}td�|j�D��}|jdd�jd�SWdQXdS(sb
    Retrieve data about System OS release from provided file.

    :return: `str` version_id
    css3|])}d|kr|j�jdd�VqdS(t=iN(tstripR(t.0tl((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pys	<genexpr>Nst
VERSION_IDtt"N(topentdictt	readlinestgetR!(tfilepathtftdata((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_os_release_version_idGscCsbddlm}|jdddd�}ttj|t���}tj	|j
��}WdQX|S(Ni����(tutilt	repo_paths/etc/leapp/repo.d/tmanager(tleapp.cli.commands.upgradeR/tload_repositories_fromtNoneR'Rtget_common_file_pathtLEAPP_UPGRADE_PATHStjsontloadstread(R/t
repositoryR,tupgrade_paths_map((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_upgrade_paths_configRs
cCs%t�}|j|i�j|g�S(st
    Retrieve all possible target versions from upgrade_paths_map.
    If no match is found returns empty list.
    (R<R*(tsrc_version_idtflavorR;((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_target_versions_from_config\s	cCsCtd�}t||�}|s?t|�}t||�}n|S(s�
    Return a list of supported target versions for the given `flavour` of upgrade.
    The default value for `flavour` is `default`.
    s/etc/os-release(R.R?R(tflavourtcurrent_version_idttarget_versionst
major_version((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_supported_target_versionsescCst|�}|r|dSdS(Ni����(RDR4(R@RB((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytget_target_versionwsc
Cs�t�}tjd�}|r2t|�||fS|jpDt|�}t|�}||kr�tdjd|d|ddj	|����n||fS(s2
    Make sure the user requested upgrade_path is a supported one.
    If LEAPP_DEVEL_TARGET_RELEASE is set then it's value is not vetted against upgrade_paths_map but used as is.

    :raises: `CommandError` if the specified upgrade_path is not supported
    :return: `tuple` (target_release, flavor)
    tLEAPP_DEVEL_TARGET_RELEASEsZUpgrade to {to} for {flavor} upgrade path is not supported, possible choices are {choices}ttoR>tchoicest,(
RRtgetenvR
ttargetRERDRR
R(targsR>tenv_version_overridettarget_releasetsupported_target_versions((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytvet_upgrade_path|s	

	cCs�d�}tjtj�\}}tjtj�\}}d}tj}||krj|tj||�n||kr�|tj||�ndS(s�
    Set resource limits for the maximum number of open file descriptors and the maximum writable file size.

    :raises: `CommandError` if the resource limits cannot be set
    cSs�|tjkrdn|tjkr*dnd}ytj|||f�WnUtk
rw}tdj||���n+tk
r�}tdj||���nXdS(Nsopen file descriptorsswritable file sizesunknown resourceslFailure occurred while attempting to set soft limit higher than the hard limit. Resource type: {}, error: {}s:Failed to set resource limit. Resource type: {}, error: {}(tresourcet
RLIMIT_NOFILEtRLIMIT_FSIZEt	setrlimitt
ValueErrorRR
tOSError(t
resource_typetsoftthardtrtype_stringterr((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytset_resource_limit�siiNi@(RQt	getrlimitRRRSt
RLIM_INFINITY(R\tsoft_nofilet_t
soft_fsizetnofile_limittfsize_limit((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pytset_resource_limits�s		c
Cs�td�|jD��}tj|�}|jdd�}tj||�}tj|�}tj	|j
d��j�}tj
d|d|�}tjd|d|�}	|	j�dS(	s�
    Load actor configuration so that actor's can access it and store it into leapp db.

    :param context: Current execution context
    :param repositories: Discovered repositories
    :param framework_cfg: Leapp's configuration
    css|]}|jVqdS(N(tconfig_schemas(R"tactor((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pys	<genexpr>�stactor_configRsutf-8Rthash_idtcontextN(ttupletactorsRgtnormalize_schemasR*tloadR7tdumpsthashlibtsha256tencodet	hexdigestRtActorConfigDatatActorConfigtstore(
Ritrepositoriest
framework_cfgtactor_config_schemastactor_config_patht	actor_cfgtconfig_texttconfig_text_hashtconfig_datat	db_config((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pyt%load_actor_configs_and_store_it_in_db�s(!RoR7RRRQtleapp.actorsRRgtleapp.exceptionsRtleapp.utilsRRRRRRRR6tcompileR	R
RRRR.R<R?RDRERPRdR(((sD/usr/lib/python2.7/site-packages/leapp/cli/commands/command_utils.pyt<module>s4	
	
					
					%