8000 Merge branch 'develop' into add-accept-ra-option · saltstack/salt@b10a4fd · GitHub
[go: up one dir, main page]

Skip to content

Commit b10a4fd

Browse files
authored
Merge branch 'develop' into add-accept-ra-option
2 parents 5afdeb7 + c9c3a4b commit b10a4fd

File tree

8 files changed

+101
-47
lines changed

8 files changed

+101
-47
lines changed

doc/man/salt.7

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390989,7 +390989,7 @@ Rbenv will be installed automatically the first time it is needed and can be
390989390989
updated later. This module will \fInot\fP automatically install packages which rbenv
390990390990
will need to compile the versions of ruby. If your version of ruby fails to
390991390991
install, refer to the ruby\-build documentation to verify you are not missing any
390992-
dependencies: \fI\%https://github.com/sstephenson/ruby\-build/wiki\fP
390992+
dependencies: \fI\%https://github.com/rbenv/ruby\-build/wiki\fP
390993390993
.sp
390994390994
If rbenv is run as the root user then it will be installed to /usr/local/rbenv,
390995390995
otherwise it will be installed to the users ~/.rbenv directory. To make

salt/modules/rbenv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numbe 8000 rDiff line change
@@ -121,7 +121,7 @@ def _install_rbenv(path, runas=None):
121121
if os.path.isdir(path):
122122
return True
123123

124-
cmd = ['git', 'clone', 'https://github.com/sstephenson/rbenv.git', path]
124+
cmd = ['git', 'clone', 'https://github.com/rbenv/rbenv.git', path]
125125
return __salt__['cmd.retcode'](cmd, runas=runas, python_shell=False) == 0
126126

127127

@@ -131,7 +131,7 @@ def _install_ruby_build(path, runas=None):
131131
return True
132132

133133
cmd = ['git', 'clone',
134-
'https://github.com/sstephenson/ruby-build.git', path]
134+
'https://github.com/rbenv/ruby-build.git', path]
135135
return __salt__['cmd.retcode'](cmd, runas=runas, python_shell=False) == 0
136136

137137

salt/modules/slsutil.py

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,11 @@ def banner(width=72, commentchar='#', borderchar='#', blockstart=None, blockend=
279279
:param newline: Boolean value to indicate whether the comment block should
280280
end with a newline. Default is ``False``.
281281
282-
This banner can be injected into any templated file, for example:
282+
**Example 1 - the default banner:**
283283
284284
.. code-block:: jinja
285285
286-
{{ salt['slsutil.banner'](width=120, commentchar='//') }}
287-
288-
The default banner:
286+
{{ salt['slsutil.banner']() }}
289287
290288
.. code-block:: none
291289
@@ -296,6 +294,42 @@ def banner(width=72, commentchar='#', borderchar='#', blockstart=None, blockend=
296294
# The contents of this file are managed by Salt. Any changes to this #
297295
# file may be overwritten automatically and without warning. #
298296
########################################################################
297+
298+
**Example 2 - a Javadoc-style banner:**
299+
300+
.. code-block:: jinja
301+
302+
{{ salt['slsutil.banner'](commentchar=' *', borderchar='*', blockstart='/**', blockend=' */') }}
303+
304+
.. code-block:: none
305+
306+
/**
307+
***********************************************************************
308+
* *
309+
* THIS FILE IS MANAGED BY SALT - DO NOT EDIT *
310+
* *
311+
* The contents of this file are managed by Salt. Any changes to this *
312+
* file may be overwritten automatically and without warning. *
313+
***********************************************************************
314+
*/
315+
316+
**Example 3 - custom text:**
317+
318+
.. code-block:: jinja
319+
320+
{{ set copyright='This file may not be copied or distributed without permission of SaltStack, Inc.' }}
321+
{{ salt['slsutil.banner'](title='Copyright 2019 SaltStack, Inc.', text=copyright, width=60) }}
322+
323+
.. code-block:: none
324+
325+
############################################################
326+
# #
327+
# Copyright 2019 SaltStack, Inc. #
328+
# #
329+
# This file may not be copied or distributed without #
330+
# permission of SaltStack, Inc. #
331+
############################################################
332+
299333
'''
300334

301335
if title is None:
@@ -304,18 +338,26 @@ def banner(width=72, commentchar='#', borderchar='#', blockstart=None, blockend=
304338
if text is None:
305339
text = ('The contents of this file are managed by Salt. '
306340
'Any changes to this file may be overwritten '
307-
'automatically and without warning')
341+
'automatically and without warning.')
308342

309343
# Set up some typesetting variables
310-
lgutter = commentchar.strip() + ' '
311-
rgutter = ' ' + commentchar.strip()
344+
ledge = commentchar.rstrip()
345+
redge = commentchar.strip()
346+
lgutter = ledge + ' '
347+
rgutter = ' ' + redge
312348
textwidth = width - len(lgutter) - len(rgutter)
313-
border_line = commentchar + borderchar[:1] * (width - len(commentchar) * 2) + commentchar
349+
350+
# Check the width
351+
if textwidth <= 0:
352+
raise salt.exceptions.ArgumentValueError('Width is too small to render banner')
353+
354+
# Define the static elements
355+
border_line = commentchar + borderchar[:1] * (width - len(ledge) - len(redge)) + redge
314356
spacer_line = commentchar + ' ' * (width - len(commentchar) * 2) + commentchar
315-
wrapper = textwrap.TextWrapper(width=(width - len(lgutter) - len(rgutter)))
316-
block = list()
317357

318358
# Create the banner
359+
wrapper = textwrap.TextWrapper(width=textwidth)
360+
block = list()
319361
if blockstart is not None:
320362
block.append(blockstart)
321363
block.append(border_line)

salt/modules/state.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,14 @@ def apply_(mods=None, **kwargs):
683683
684684
# Run the states configured in salt://stuff.sls (or salt://stuff/init.sls)
685685
salt '*' state.apply stuff
686+
686687
# Run the states configured in salt://stuff.sls (or salt://stuff/init.sls)
687688
# and salt://pkgs.sls (or salt://pkgs/init.sls).
688689
salt '*' state.apply stuff,pkgs
689690
691+
# Run the states configured in a more deeply nested directory such as salt://my/organized/stuff.sls (or salt://my/organized/stuff/init.sls)
692+
salt '*' state.apply my.organized.stuff
693+
690694
The following additional arguments are also accepted when applying
691695
individual SLS files:
692696
@@ -1176,14 +1180,13 @@ def sls(mods, test=None, exclude=None, queue=False, sync_mods=None, **kwargs):
11761180
used, all Pillar environments will be merged together.
11771181
11781182
localconfig
1179-
11801183
Optionally, instead of using the minion config, load minion opts from
11811184
the file specified by this argument, and then merge them with the
11821185
options from the minion config. This functionality allows for specific
11831186
states to be run with their own custom minion configuration, including
11841187
different pillars, file_roots, etc.
11851188
1186-
mock:
1189+
mock
11871190
The mock option allows for the state run to execute without actually
11881191
calling any states. This then returns a mocked return which will show
11891192
the requisite ordering as well as fully validate the state run.
@@ -1205,9 +1208,17 @@ def sls(mods, test=None, exclude=None, queue=False, sync_mods=None, **kwargs):
12051208
12061209
.. code-block:: bash
12071210
1208-
salt '*' state.sls core,edit.vim dev
1209-
salt '*' state.sls core exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
1211+
# Run the states configured in salt://example.sls (or salt://example/init.sls)
1212+
salt '*' state.apply example
1213+
1214+
# Run the states configured in salt://core.sls (or salt://core/init.sls)
1215+
# and salt://edit/vim.sls (or salt://edit/vim/init.sls)
1216+
salt '*' state.sls core,edit.vim
12101217
1218+
# Run the states configured in a more deeply nested directory such as salt://my/nested/state.sls (or salt://my/nested/state/init.sls)
1219+
salt '*' state.sls my.nested.state
1220+
1221+
salt '*' state.sls core exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
12111222
salt '*' state.sls myslsfile pillar="{foo: 'Foo!', bar: 'Bar!'}"
12121223
'''
12131224
concurrent = kwargs.get('concurrent', False)

salt/modules/x509.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ def read_certificate(certificate):
590590

591591
def read_certificates(glob_path):
592592
'''
593-
Returns a dict containing details of a all certificates matching a glob
593+
Returns a dict containing details of all certificates matching a glob
594594
595595
glob_path:
596596
A path to certificates to be read and returned.
@@ -651,8 +651,8 @@ def read_crl(crl):
651651
652652
:depends: - OpenSSL command line tool
653653
654-
csl:
655-
A path or PEM encoded string containing the CSL to read.
654+
crl:
655+
A path or PEM encoded string containing the CRL to read.
656656
657657
CLI Example:
658658
@@ -747,17 +747,17 @@ def write_pem(text, path, overwrite=True, pem_type=None):
747747
PEM string input to be written out.
748748
749749
path:
750-
Path of the file to write the pem out to.
750+
Path of the file to write the PEM out to.
751751
752752
overwrite:
753-
If True(default), write_pem will overwrite the entire pem file.
753+
If ``True`` (default), write_pem will overwrite the entire PEM file.
754754
Set False to preserve existing private keys and dh params that may
755-
exist in the pem file.
755+
exist in the PEM file.
756756
757757
pem_type:
758758
The PEM type to be saved, for example ``CERTIFICATE`` or
759759
``PUBLIC KEY``. Adding this will allow the function to take
760-
input that may contain multiple pem types.
760+
input that may contain multiple PEM types.
761761
762762
CLI Example:
763763
@@ -871,22 +871,22 @@ def create_crl( # pylint: disable=too-many-arguments,too-many-locals
871871
:depends: - PyOpenSSL Python module
872872
873873
path:
874-
Path to write the crl to.
874+
Path to write the CRL to.
875875
876876
text:
877877
If ``True``, return the PEM text without writing to a file.
878878
Default ``False``.
879879
880880
signing_private_key:
881881
A path or string of the private key in PEM format that will be used
882-
to sign this crl. This is required.
882+
to sign the CRL. This is required.
883883
884884
signing_private_key_passphrase:
885885
Passphrase to decrypt the private key.
886886
887887
signing_cert:
888888
A certificate matching the private key that will be used to sign
889-
this crl. This is required.
889+
the CRL. This is required.
890890
891891
revoked:
892892
A list of dicts containing all the certificates to revoke. Each dict
@@ -1119,9 +1119,9 @@ def create_certificate(
11191119
Default ``False``.
11201120
11211121
overwrite:
1122-
If True(default), create_certificate will overwrite the entire pem
1122+
If ``True`` (default), create_certificate will overwrite the entire PEM
11231123< 10000 /td>
file. Set False to preserve existing private keys and dh params that
1124-
may exist in the pem file.
1124+
may exist in the PEM file.
11251125
11261126
kwargs:
11271127
Any of the properties below can be included as additional
@@ -1131,7 +1131,7 @@ def create_certificate(
11311131
Request a remotely signed certificate from ca_server. For this to
11321132
work, a ``signing_policy`` must be specified, and that same policy
11331133
must be configured on the ca_server (name or list of ca server). See ``signing_policy`` for
1134-
details. Also the salt master must permit peers to call the
1134+
details. Also, the salt master must permit peers to call the
11351135
``sign_remote_certificate`` function.
11361136
11371137
Example:
@@ -1192,7 +1192,7 @@ def create_certificate(
11921192
11931193
public_key:
11941194
The public key to be included in this certificate. This can be sourced
1195-
from a public key, certificate, csr or private key. If a private key
1195+
from a public key, certificate, CSR or private key. If a private key
11961196
is used, the matching public key from the private key will be
11971197
generated before any processing is done. This means you can request a
11981198
certificate from a remote CA using a private key file as your
@@ -1256,7 +1256,7 @@ def create_certificate(
12561256
X509v3 Subject Alternative Name
12571257
12581258
crlDistributionPoints:
1259-
X509v3 CRL distribution points
1259+
X509v3 CRL Distribution points
12601260
12611261
issuingDistributionPoint:
12621262
X509v3 Issuing Distribution Point
@@ -1316,7 +1316,7 @@ def create_certificate(
13161316
signing_policy:
13171317
A signing policy that should be used to create this certificate.
13181318
Signing policies should be defined in the minion configuration, or in
1319-
a minion pillar. It should be a yaml formatted list of arguments
1319+
a minion pillar. It should be a YAML formatted list of arguments
13201320
which will override any arguments passed to this function. If the
13211321
``minions`` key is included in the signing policy, only minions
13221322
matching that pattern (see match.glob and match.compound) will be
@@ -1717,7 +1717,7 @@ def verify_private_key(private_key, public_key, passphrase=None):
17171717
17181718
public_key:
17191719
The public key to verify, can be a string or path to a PEM formatted
1720-
certificate, csr, or another private key.
1720+
certificate, CSR, or another private key.
17211721
17221722
passphrase:
17231723
Passphrase to decrypt the private key.
@@ -1743,7 +1743,7 @@ def verify_signature(certificate, signing_pub_key=None,
17431743
17441744
signing_pub_key:
17451745
The public key to verify, can be a string or path to a PEM formatted
1746-
certificate, csr, or private key.
1746+
certificate, CSR, or private key.
17471747
17481748
signing_pub_key_passphrase:
17491749
Passphrase to the signing_pub_key if it is an encrypted private key.
@@ -1883,7 +1883,7 @@ def will_expire(certificate, days):
18831883
ret['cn'] = _parse_subject(cert.get_subject())['CN']
18841884
ret['will_expire'] = _expiration_date.strftime(ts_pt) <= _check_time.strftime(ts_pt)
18851885
except ValueError as err:
1886-
log.debug('Unable to return details of a sertificate expiration: %s', err)
1886+
log.debug('Unable to return details of a certificate expiration: %s', err)
18871887
log.trace(err, exc_info=True)
18881888

18891889
return ret

salt/states/rbenv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
updated later. This module will *not* automatically install packages which rbenv
1010
will need to compile the versions of ruby. If your version of ruby fails to
1111
install, refer to the ruby-build documentation to verify you are not missing any
12-
dependencies: https://github.com/sstephenson/ruby-build/wiki
12+
dependencies: https://github.com/rbenv/ruby-build/wiki
1313
1414
If rbenv is run as the root user then it will be installed to /usr/local/rbenv,
1515
otherwise it will be installed to the users ~/.rbenv directory. To make

salt/states/x509.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
:depends: M2Crypto
88
9-
This module can enable managing a complete PKI infrastructure including creating private keys, CA's,
9+
This module can enable managing a complete PKI infrastructure including creating private keys, CAs,
1010
certificates and CRLs. It includes the ability to generate a private key on a server, and have the
1111
corresponding public key sent to a remote CA to create a CA signed certificate. This can be done in
1212
a secure manner, where private keys are always generated locally and never moved across the network.
@@ -117,7 +117,7 @@
117117
118118
119119
This state will instruct all minions to trust certificates signed by our new CA.
120-
Using jinja to strip newlines from the text avoids dealing with newlines in the rendered yaml,
120+
Using Jinja to strip newlines from the text avoids dealing with newlines in the rendered YAML,
121121
and the :mod:`sign_remote_certificate <salt.states.x509.sign_remote_certificate>` state will
122122
handle properly formatting the text before writing the output.
123123
@@ -267,7 +267,7 @@ def private_key_managed(name,
267267
Cipher for encrypting the private key.
268268
269269
new:
270-
Always create a new key. Defaults to False.
270+
Always create a new key. Defaults to ``False``.
271271
Combining new with :mod:`prereq <salt.states.requsities.preqreq>`, or when used as part of a
272272
`managed_private_key` can allow key rotation whenever a new certificiate is generated.
273273
@@ -285,7 +285,7 @@ def private_key_managed(name,
285285
286286
Example:
287287
288-
The jinja templating in this example ensures a private key is generated if the file doesn't exist
288+
The Jinja templating in this example ensures a private key is generated if the file doesn't exist
289289
and that a new private key is generated whenever the certificate that uses it is to be renewed.
290290
291291
.. code-block:: jinja
@@ -404,7 +404,7 @@ def certificate_managed(name,
404404
Manages the private key corresponding to the certificate. All of the
405405
arguments supported by :py:func:`x509.private_key_managed
406406
<salt.states.x509.private_key_managed>` are supported. If `name` is not
407-
speicified or is the same as the name of the certificate, the private
407+
specified or is the same as the name of the certificate, the private
408408
key and certificate will be written together in the same file.
409409
410410
append_certs:
@@ -627,14 +627,14 @@ def crl_managed(name,
627627
Path to the certificate
628628
629629
signing_private_key
630-
The private key that will be used to sign this crl. This is
630+
The private key that will be used to sign the CRL. This is
631631
usually your CA's private key.
632632
633633
signing_private_key_passphrase
634634
Passphrase to decrypt the private key.
635635
636636
signing_cert
637-
The certificate of the authority that will be used to sign this crl.
637+
The certificate of the authority that will be used to sign the CRL.
638638
This is usually your CA's certificate.
639639
640640
revoked
@@ -650,8 +650,8 @@ def crl_managed(name,
650650
of pyOpenSSL less than 0.14.
651651
652652
days_remaining : 30
653-
The crl should be automatically recreated if there are less than
654-
``days_remaining`` days until the crl expires. Set to 0 to disable
653+
The CRL should be automatically recreated if there are less than
654+
``days_remaining`` days until the CRL expires. Set to 0 to disable
655655
automatic renewal.
656656
657657
include_expired : False

0 commit comments

Comments
 (0)
0