%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/seed.pyc

�
���^c	@@s8dZddlmZmZmZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZeje�Zidd6Zd�Zd�Zdd�Zd	�Zddeeedddd
�Zdddeddd�Zd�Zd
�Zd�ZdS(u(
Virtual machine image management tools
i(tabsolute_importtunicode_literalstprint_functionNuapplyuapply_cC@sPtjj|�rLtjjj|�� }tjjj|j	��SWdQXn|S(N(
tostpathtexiststsalttutilstfilestfopentstringutilst
to_unicodetread(tfile_tfic((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyt_file_or_content s"cC@s�td�}tjj|ddjtj���}tjj|�sVtj|�ntj	|d�tjj|tjj
|��}tj||�|j
|d�}||fS(u�
    Update and get the random script to a random place

    CLI Example:

    .. code-block:: bash

        salt '*' seed.prep_bootstrap /tmp

    uconfig.gather_bootstrap_scriptutmpu{0}i�u(t__salt__RRtjointformattuuidtuuid4Rtmakedirstchmodtbasenametshutiltcopytreplace(tmpttbs_tfpd_tfp_ttmppath((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pytprep_bootstrap's
!cC@s�d}|dkrEtj�}td||�s�tj|�dSns|dkrU|S|dkr�dtkrvd}ndtkr�d}ndStd|d	|d
|�}|s�dSn|S(Nublockumount.mountudirufileu
guestfs.mountuguestfsu
qemu_nbd.inituqemu_nbdtdevicetutil(tNonettempfiletmkdtempRRtrmdir(RtftypetrootRR"((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyt_mount@s$
		cC@sQ|dkr*td|�tj|�n#|dkrMtd|dd�ndS(Nublockumount.umountufileR"uqemu_nbd(RRR&(RR'((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyt_umountVs
c	C@s�td|dt�}	|	s)dj|�S|	d}
|	d}tjd|
|�ytj|�Wntk
rtnXt||
|�}|s�dj|�Stj	j
|d�}tjd	|�ytj|�Wn)tk
r�tj	j|�s��q�nXt|d
|d|d|d
|d|�}
t
|�rBtjd|�tjj|
d�}|d}tj	jtj	j
||jd���s�tdtj	j
||jd�d��ntj|
dtj	j
||jd�d��tj|
dtj	j
||jd�d��tj|
dtj	j
|d��t}n`|rgtjd|�t|�}n;|r�tjdtjj�t}ntjd|�t}t||
�|S(u
    Seed a location (disk image, directory, or block device) with the
    minion config, approve the minion's key, and/or install salt-minion.

    CLI Example:

    .. code-block:: bash

        salt 'minion' seed.apply path id [config=config_data] \
                [gen_key=(true|false)] [approve_key=(true|false)] \
                [install=(true|false)]

    path
        Full path to the directory, device, or disk image  on the target
        minion's file system.

    id
        Minion id with which to seed the path.

    config
        Minion configuration options. By default, the 'master' option is set to
        the target host's 'master'.

    approve_key
        Request a pre-approval of the generated minion key. Requires
        that the salt-master be configured to either auto-accept all keys or
        expect a signing request from the target host. Default: true.

    install
        Install salt-minion, if absent. Default: true.

    prep_install
        Prepare the bootstrap script, but don't run it. Default: false
    u
file.statstfollow_symlinksu{0} does not existutypeutargetuMounting %s at %su{0} could not be mountedutmpu!Attempting to create directory %sttmptid_tapprove_keytpub_keytpriv_keyu5salt-minion pre-installed on image, configuring as %suconfigupki_diru/u
file.makedirsuuprivkeyu
minion.pemupubkeyu
minion.pubuetc/salt/minionu'Attempting to install salt-minion to %susThe prep_install option is no longer supported. Please use the bootstrap script installed with Salt, located at %s.u No useful action performed on %s(RtTrueRtlogtdebugRRtOSErrorR)RRtisdirtmkconfigt_check_installtinfoRtconfigt
minion_configtlstriptrenamet_installterrortsyspathst	BOOTSTRAPtFalsetwarningR*(RR-R9R.tinstalltprep_installR/R0tmount_pointtstatsR'RR,t	cfg_filesR:tpki_dirtres((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pytapply_^s^$






	
*%#		
	
c
C@sZ|dkrtj�}n|dkr0i}nd|kr]tddkr]td|d<n|rp||d<ntjj|d�}tjj	j
|d��#}|jtjjj
|��WdQXtjj|d�}tjj|d�}	|o�|}
|
r�tjd	|�tjd
|	�tjj	j
|d��)}|jtjjjt|���WdQXtjj	j
|	d��)}|jtjjjt|���WdQXtj|d�tj|	d�ntjj|dd
�|rA|
rAtjj	j
|��=}tjjj|j��}tdi||gd6�WdQXni|d6|d6|	d6S(u�
    Generate keys and config and put them in a tmp directory.

    pub_key
        absolute path or file content of an optional preseeded salt key

    priv_key
        absolute path or file content of an optional preseeded salt key

    CLI Example:

    .. code-block:: bash

        salt 'minion' seed.mkconfig [config=config_data] [tmp=tmp_dir] \
                [id_=minion_id] [approve_key=(true|false)]
    umasterusaltuiduminionuw+Nu
minion.pubu
minion.pemuWriting minion.pub to %suWriting minion.pem to %suwi�iu
pillar.extuvirtkeyuconfigupubkeyuprivkey(R#R$R%t__opts__RRRRRRR	twritetcloudtsalt_config_to_yamlR2R3R
tto_strRRtcrypttgen_keysRRR(
R9R,R-R.R/R0t
tmp_configRtpubkeyfnt	privkeyfnt	preseededRtpubkey((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyR6�s:	
"((
$cC@slt|�t|�ptjj\}}d}|djtjj|d��7}t	d||dt
�dS(u�
    Determine whether salt-minion is installed and, if not,
    install it.
    Return True if install is successful or already installed.
    u"if type salt-minion; then exit 0; uelse sh {0} -c /tmp; fiubootstrap-salt.shucmd.run_chroottpython_shelluretcode(t
_check_resolvR RR?R@RRRRRR1(Rtboot_Rtcmd((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyR=�s
"cC@s#tjj|d�}t}tjj|�r|tjj|�}tjjtjj|��s|tjtjj|��q|ntjj	|�s�t
}n|stjj
j|d��L}tjjj|j��}d|kr�t
}nd|kr�t
}nWdQXn|rtjd|�ndS(u=
    Check that the resolv.conf is present and populated
    uetc/resolv.confurbu
nameserverunameserver 127.0.0.1Nu/etc/resolv.conf(RRRRAtislinktrealpathR5tdirnameRtisfileR1RRRR	R
RRRR(RtresolvRRtconts((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyRXs"		cC@sfd}tjjtjj|d��r0d}nd}dj|||�}td|ddd	t�S(
Nu/bin/shubin/bashu	/bin/bashu&if ! type salt-minion; then exit 1; fiuchroot '{0}' {1} -c '{2}'ucmd.retcodetoutput_logleveluquietRW(RRR^RRRR1(R(tsh_RZ((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyR7s!		
( t__doc__t
__future__RRRRRtloggingR$t
salt.cryptRtsalt.utils.cloudtsalt.utils.filestsalt.configt
salt.syspathsRt	getLoggert__name__R2t__func_alias__RR R#R)R*R1RARJR6R=RXR7(((s5/usr/lib/python2.7/site-packages/salt/modules/seed.pyt<module>s:
			_6		

Zerion Mini Shell 1.0