1"""
2The Saltutil runner is used to sync custom types to the Master. See the
3:mod:`saltutil module <salt.modules.saltutil>` for documentation on
4managing updates to minions.
5
6.. versionadded:: 2016.3.0
7"""
8
9import logging
10
11import salt.utils.extmods
12
13log = logging.getLogger(__name__)
14
15
16def sync_all(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
17    """
18    Sync all custom types
19
20    saltenv : base
21        The fileserver environment from which to sync. To sync from more than
22        one environment, pass a comma-separated list.
23
24    extmod_whitelist : None
25        dictionary of modules to sync based on type
26
27    extmod_blacklist : None
28        dictionary of modules to blacklist based on type
29
30    CLI Example:
31
32    .. code-block:: bash
33
34        salt-run saltutil.sync_all
35        salt-run saltutil.sync_all extmod_whitelist={'runners': ['custom_runner'], 'grains': []}
36    """
37    log.debug("Syncing all")
38    ret = {}
39    ret["clouds"] = sync_clouds(
40        saltenv=saltenv,
41        extmod_whitelist=extmod_whitelist,
42        extmod_blacklist=extmod_blacklist,
43    )
44    ret["modules"] = sync_modules(
45        saltenv=saltenv,
46        extmod_whitelist=extmod_whitelist,
47        extmod_blacklist=extmod_blacklist,
48    )
49    ret["states"] = sync_states(
50        saltenv=saltenv,
51        extmod_whitelist=extmod_whitelist,
52        extmod_blacklist=extmod_blacklist,
53    )
54    ret["grains"] = sync_grains(
55        saltenv=saltenv,
56        extmod_whitelist=extmod_whitelist,
57        extmod_blacklist=extmod_blacklist,
58    )
59    ret["renderers"] = sync_renderers(
60        saltenv=saltenv,
61        extmod_whitelist=extmod_whitelist,
62        extmod_blacklist=extmod_blacklist,
63    )
64    ret["returners"] = sync_returners(
65        saltenv=saltenv,
66        extmod_whitelist=extmod_whitelist,
67        extmod_blacklist=extmod_blacklist,
68    )
69    ret["output"] = sync_output(
70        saltenv=saltenv,
71        extmod_whitelist=extmod_whitelist,
72        extmod_blacklist=extmod_blacklist,
73    )
74    ret["proxymodules"] = sync_proxymodules(
75        saltenv=saltenv,
76        extmod_whitelist=extmod_whitelist,
77        extmod_blacklist=extmod_blacklist,
78    )
79    ret["runners"] = sync_runners(
80        saltenv=saltenv,
81        extmod_whitelist=extmod_whitelist,
82        extmod_blacklist=extmod_blacklist,
83    )
84    ret["wheel"] = sync_wheel(
85        saltenv=saltenv,
86        extmod_whitelist=extmod_whitelist,
87        extmod_blacklist=extmod_blacklist,
88    )
89    ret["engines"] = sync_engines(
90        saltenv=saltenv,
91        extmod_whitelist=extmod_whitelist,
92        extmod_blacklist=extmod_blacklist,
93    )
94    ret["thorium"] = sync_thorium(
95        saltenv=saltenv,
96        extmod_whitelist=extmod_whitelist,
97        extmod_blacklist=extmod_blacklist,
98    )
99    ret["queues"] = sync_queues(
100        saltenv=saltenv,
101        extmod_whitelist=extmod_whitelist,
102        extmod_blacklist=extmod_blacklist,
103    )
104    ret["pillar"] = sync_pillar(
105        saltenv=saltenv,
106        extmod_whitelist=extmod_whitelist,
107        extmod_blacklist=extmod_blacklist,
108    )
109    ret["utils"] = sync_utils(
110        saltenv=saltenv,
111        extmod_whitelist=extmod_whitelist,
112        extmod_blacklist=extmod_blacklist,
113    )
114    ret["sdb"] = sync_sdb(
115        saltenv=saltenv,
116        extmod_whitelist=extmod_whitelist,
117        extmod_blacklist=extmod_blacklist,
118    )
119    ret["cache"] = sync_cache(
120        saltenv=saltenv,
121        extmod_whitelist=extmod_whitelist,
122        extmod_blacklist=extmod_blacklist,
123    )
124    ret["fileserver"] = sync_fileserver(
125        saltenv=saltenv,
126        extmod_whitelist=extmod_whitelist,
127        extmod_blacklist=extmod_blacklist,
128    )
129    ret["tops"] = sync_tops(
130        saltenv=saltenv,
131        extmod_whitelist=extmod_whitelist,
132        extmod_blacklist=extmod_blacklist,
133    )
134    ret["tokens"] = sync_eauth_tokens(
135        saltenv=saltenv,
136        extmod_whitelist=extmod_whitelist,
137        extmod_blacklist=extmod_blacklist,
138    )
139    ret["serializers"] = sync_serializers(
140        saltenv=saltenv,
141        extmod_whitelist=extmod_whitelist,
142        extmod_blacklist=extmod_blacklist,
143    )
144    ret["executors"] = sync_executors(
145        saltenv=saltenv,
146        extmod_whitelist=extmod_whitelist,
147        extmod_blacklist=extmod_blacklist,
148    )
149    return ret
150
151
152def sync_modules(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
153    """
154    Sync execution modules from ``salt://_modules`` to the master
155
156    saltenv : base
157        The fileserver environment from which to sync. To sync from more than
158        one environment, pass a comma-separated list.
159
160    extmod_whitelist : None
161        comma-separated list of modules to sync
162
163    extmod_blacklist : None
164        comma-separated list of modules to blacklist based on type
165
166    CLI Example:
167
168    .. code-block:: bash
169
170        salt-run saltutil.sync_modules
171    """
172    return salt.utils.extmods.sync(
173        __opts__,
174        "modules",
175        saltenv=saltenv,
176        extmod_whitelist=extmod_whitelist,
177        extmod_blacklist=extmod_blacklist,
178    )[0]
179
180
181def sync_states(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
182    """
183    Sync state modules from ``salt://_states`` to the master
184
185    saltenv : base
186        The fileserver environment from which to sync. To sync from more than
187        one environment, pass a comma-separated list.
188
189    extmod_whitelist : None
190        comma-separated list of modules to sync
191
192    extmod_blacklist : None
193        comma-separated list of modules to blacklist based on type
194
195    CLI Example:
196
197    .. code-block:: bash
198
199        salt-run saltutil.sync_states
200    """
201    return salt.utils.extmods.sync(
202        __opts__,
203        "states",
204        saltenv=saltenv,
205        extmod_whitelist=extmod_whitelist,
206        extmod_blacklist=extmod_blacklist,
207    )[0]
208
209
210def sync_grains(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
211    """
212    Sync grains modules from ``salt://_grains`` to the master
213
214    saltenv : base
215        The fileserver environment from which to sync. To sync from more than
216        one environment, pass a comma-separated list.
217
218    extmod_whitelist : None
219        comma-separated list of modules to sync
220
221    extmod_blacklist : None
222        comma-separated list of modules to blacklist based on type
223
224    CLI Example:
225
226    .. code-block:: bash
227
228        salt-run saltutil.sync_grains
229    """
230    return salt.utils.extmods.sync(
231        __opts__,
232        "grains",
233        saltenv=saltenv,
234        extmod_whitelist=extmod_whitelist,
235        extmod_blacklist=extmod_blacklist,
236    )[0]
237
238
239def sync_renderers(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
240    """
241    Sync renderer modules from from ``salt://_renderers`` to the master
242
243    saltenv : base
244        The fileserver environment from which to sync. To sync from more than
245        one environment, pass a comma-separated list.
246
247    extmod_whitelist : None
248        comma-separated list of modules to sync
249
250    extmod_blacklist : None
251        comma-separated list of modules to blacklist based on type
252
253    CLI Example:
254
255    .. code-block:: bash
256
257        salt-run saltutil.sync_renderers
258    """
259    return salt.utils.extmods.sync(
260        __opts__,
261        "renderers",
262        saltenv=saltenv,
263        extmod_whitelist=extmod_whitelist,
264        extmod_blacklist=extmod_blacklist,
265    )[0]
266
267
268def sync_returners(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
269    """
270    Sync returner modules from ``salt://_returners`` to the master
271
272    saltenv : base
273        The fileserver environment from which to sync. To sync from more than
274        one environment, pass a comma-separated list.
275
276    extmod_whitelist : None
277        comma-separated list of modules to sync
278
279    extmod_blacklist : None
280        comma-separated list of modules to blacklist based on type
281
282    CLI Example:
283
284    .. code-block:: bash
285
286        salt-run saltutil.sync_returners
287    """
288    return salt.utils.extmods.sync(
289        __opts__,
290        "returners",
291        saltenv=saltenv,
292        extmod_whitelist=extmod_whitelist,
293        extmod_blacklist=extmod_blacklist,
294    )[0]
295
296
297def sync_output(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
298    """
299    Sync output modules from ``salt://_output`` to the master
300
301    saltenv : base
302        The fileserver environment from which to sync. To sync from more than
303        one environment, pass a comma-separated list.
304
305    extmod_whitelist : None
306        comma-separated list of modules to sync
307
308    extmod_blacklist : None
309        comma-separated list of modules to blacklist based on type
310
311    CLI Example:
312
313    .. code-block:: bash
314
315        salt-run saltutil.sync_output
316    """
317    return salt.utils.extmods.sync(
318        __opts__,
319        "output",
320        saltenv=saltenv,
321        extmod_whitelist=extmod_whitelist,
322        extmod_blacklist=extmod_blacklist,
323    )[0]
324
325
326def sync_proxymodules(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
327    """
328    Sync proxy modules from ``salt://_proxy`` to the master
329
330    saltenv : base
331        The fileserver environment from which to sync. To sync from more than
332        one environment, pass a comma-separated list.
333
334    extmod_whitelist : None
335        comma-separated list of modules to sync
336
337    extmod_blacklist : None
338        comma-separated list of modules to blacklist based on type
339
340    CLI Example:
341
342    .. code-block:: bash
343
344        salt-run saltutil.sync_proxymodules
345    """
346    return salt.utils.extmods.sync(
347        __opts__,
348        "proxy",
349        saltenv=saltenv,
350        extmod_whitelist=extmod_whitelist,
351        extmod_blacklist=extmod_blacklist,
352    )[0]
353
354
355def sync_runners(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
356    """
357    Sync runners from ``salt://_runners`` to the master
358
359    saltenv : base
360        The fileserver environment from which to sync. To sync from more than
361        one environment, pass a comma-separated list.
362
363    extmod_whitelist : None
364        comma-separated list of modules to sync
365
366    extmod_blacklist : None
367        comma-separated list of modules to blacklist based on type
368
369    CLI Example:
370
371    .. code-block:: bash
372
373        salt-run saltutil.sync_runners
374    """
375    return salt.utils.extmods.sync(
376        __opts__,
377        "runners",
378        saltenv=saltenv,
379        extmod_whitelist=extmod_whitelist,
380        extmod_blacklist=extmod_blacklist,
381    )[0]
382
383
384def sync_wheel(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
385    """
386    Sync wheel modules from ``salt://_wheel`` to the master
387
388    saltenv : base
389        The fileserver environment from which to sync. To sync from more than
390        one environment, pass a comma-separated list.
391
392    extmod_whitelist : None
393        comma-separated list of modules to sync
394
395    extmod_blacklist : None
396        comma-separated list of modules to blacklist based on type
397
398    CLI Example:
399
400    .. code-block:: bash
401
402        salt-run saltutil.sync_wheel
403    """
404    return salt.utils.extmods.sync(
405        __opts__,
406        "wheel",
407        saltenv=saltenv,
408        extmod_whitelist=extmod_whitelist,
409        extmod_blacklist=extmod_blacklist,
410    )[0]
411
412
413def sync_engines(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
414    """
415    Sync engines from ``salt://_engines`` to the master
416
417    saltenv : base
418        The fileserver environment from which to sync. To sync from more than
419        one environment, pass a comma-separated list.
420
421    extmod_whitelist : None
422        comma-separated list of modules to sync
423
424    extmod_blacklist : None
425        comma-separated list of modules to blacklist based on type
426
427    CLI Example:
428
429    .. code-block:: bash
430
431        salt-run saltutil.sync_engines
432    """
433    return salt.utils.extmods.sync(
434        __opts__,
435        "engines",
436        saltenv=saltenv,
437        extmod_whitelist=extmod_whitelist,
438        extmod_blacklist=extmod_blacklist,
439    )[0]
440
441
442def sync_thorium(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
443    """
444    .. versionadded:: 2018.3.0
445
446    Sync Thorium from ``salt://_thorium`` to the master
447
448    saltenv: ``base``
449        The fileserver environment from which to sync. To sync from more than
450        one environment, pass a comma-separated list.
451
452    extmod_whitelist
453        comma-separated list of modules to sync
454
455    extmod_blacklist
456        comma-separated list of modules to blacklist based on type
457
458    CLI Example:
459
460    .. code-block:: bash
461
462        salt-run saltutil.sync_thorium
463    """
464    return salt.utils.extmods.sync(
465        __opts__,
466        "thorium",
467        saltenv=saltenv,
468        extmod_whitelist=extmod_whitelist,
469        extmod_blacklist=extmod_blacklist,
470    )[0]
471
472
473def sync_queues(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
474    """
475    Sync queue modules from ``salt://_queues`` to the master
476
477    saltenv : base
478        The fileserver environment from which to sync. To sync from more than
479        one environment, pass a comma-separated list.
480
481    extmod_whitelist : None
482        comma-separated list of modules to sync
483
484    extmod_blacklist : None
485        comma-separated list of modules to blacklist based on type
486
487    CLI Example:
488
489    .. code-block:: bash
490
491        salt-run saltutil.sync_queues
492    """
493    return salt.utils.extmods.sync(
494        __opts__,
495        "queues",
496        saltenv=saltenv,
497        extmod_whitelist=extmod_whitelist,
498        extmod_blacklist=extmod_blacklist,
499    )[0]
500
501
502def sync_pillar(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
503    """
504    Sync pillar modules from ``salt://_pillar`` to the master
505
506    saltenv : base
507        The fileserver environment from which to sync. To sync from more than
508        one environment, pass a comma-separated list.
509
510    extmod_whitelist : None
511        comma-separated list of modules to sync
512
513    extmod_blacklist : None
514        comma-separated list of modules to blacklist based on type
515
516    CLI Example:
517
518    .. code-block:: bash
519
520        salt-run saltutil.sync_pillar
521    """
522    return salt.utils.extmods.sync(
523        __opts__,
524        "pillar",
525        saltenv=saltenv,
526        extmod_whitelist=extmod_whitelist,
527        extmod_blacklist=extmod_blacklist,
528    )[0]
529
530
531def sync_utils(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
532    """
533    .. versionadded:: 2016.11.0
534
535    Sync utils modules from ``salt://_utils`` to the master
536
537    saltenv : base
538        The fileserver environment from which to sync. To sync from more than
539        one environment, pass a comma-separated list.
540
541    extmod_whitelist : None
542        comma-separated list of modules to sync
543
544    extmod_blacklist : None
545        comma-separated list of modules to blacklist based on type
546
547    CLI Example:
548
549    .. code-block:: bash
550
551        salt-run saltutil.sync_utils
552    """
553    return salt.utils.extmods.sync(
554        __opts__,
555        "utils",
556        saltenv=saltenv,
557        extmod_whitelist=extmod_whitelist,
558        extmod_blacklist=extmod_blacklist,
559    )[0]
560
561
562def sync_sdb(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
563    """
564    .. versionadded:: 2017.7.0
565
566    Sync sdb modules from ``salt://_sdb`` to the master
567
568    saltenv : base
569        The fileserver environment from which to sync. To sync from more than
570        one environment, pass a comma-separated list.
571
572    extmod_whitelist : None
573        comma-separated list of modules to sync
574
575    extmod_blacklist : None
576        comma-separated list of modules to blacklist based on type
577
578    CLI Example:
579
580    .. code-block:: bash
581
582        salt-run saltutil.sync_sdb
583    """
584    return salt.utils.extmods.sync(
585        __opts__,
586        "sdb",
587        saltenv=saltenv,
588        extmod_whitelist=extmod_whitelist,
589        extmod_blacklist=extmod_blacklist,
590    )[0]
591
592
593def sync_tops(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
594    """
595    .. versionadded:: 2016.3.7,2016.11.4,2017.7.0
596
597    Sync master_tops modules from ``salt://_tops`` to the master
598
599    saltenv : base
600        The fileserver environment from which to sync. To sync from more than
601        one environment, pass a comma-separated list.
602
603    CLI Example:
604
605    .. code-block:: bash
606
607        salt-run saltutil.sync_tops
608    """
609    return salt.utils.extmods.sync(
610        __opts__,
611        "tops",
612        saltenv=saltenv,
613        extmod_whitelist=extmod_whitelist,
614        extmod_blacklist=extmod_blacklist,
615    )[0]
616
617
618def sync_cache(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
619    """
620    .. versionadded:: 2017.7.0
621
622    Sync cache modules from ``salt://_cache`` to the master
623
624    saltenv : base
625        The fileserver environment from which to sync. To sync from more than
626        one environment, pass a comma-separated list.
627
628    extmod_whitelist : None
629        comma-separated list of modules to sync
630
631    extmod_blacklist : None
632        comma-separated list of modules to blacklist based on type
633
634    CLI Example:
635
636    .. code-block:: bash
637
638        salt-run saltutil.sync_cache
639    """
640    return salt.utils.extmods.sync(
641        __opts__,
642        "cache",
643        saltenv=saltenv,
644        extmod_whitelist=extmod_whitelist,
645        extmod_blacklist=extmod_blacklist,
646    )[0]
647
648
649def sync_fileserver(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
650    """
651    .. versionadded:: 2018.3.0
652
653    Sync fileserver modules from ``salt://_fileserver`` to the master
654
655    saltenv : base
656        The fileserver environment from which to sync. To sync from more than
657        one environment, pass a comma-separated list.
658
659    extmod_whitelist : None
660        comma-separated list of modules to sync
661
662    extmod_blacklist : None
663        comma-separated list of modules to blacklist based on type
664
665    CLI Example:
666
667    .. code-block:: bash
668
669        salt-run saltutil.sync_fileserver
670    """
671    return salt.utils.extmods.sync(
672        __opts__,
673        "fileserver",
674        saltenv=saltenv,
675        extmod_whitelist=extmod_whitelist,
676        extmod_blacklist=extmod_blacklist,
677    )[0]
678
679
680def sync_clouds(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
681    """
682    .. versionadded:: 2017.7.0
683
684    Sync cloud modules from ``salt://_clouds`` to the master
685
686    saltenv : base
687        The fileserver environment from which to sync. To sync from more than
688        one environment, pass a comma-separated list.
689
690    extmod_whitelist : None
691        comma-separated list of modules to sync
692
693    extmod_blacklist : None
694        comma-separated list of modules to blacklist based on type
695
696    CLI Example:
697
698    .. code-block:: bash
699
700        salt-run saltutil.sync_clouds
701    """
702    return salt.utils.extmods.sync(
703        __opts__,
704        "clouds",
705        saltenv=saltenv,
706        extmod_whitelist=extmod_whitelist,
707        extmod_blacklist=extmod_blacklist,
708    )[0]
709
710
711def sync_roster(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
712    """
713    .. versionadded:: 2017.7.0
714
715    Sync roster modules from ``salt://_roster`` to the master
716
717    saltenv : base
718        The fileserver environment from which to sync. To sync from more than
719        one environment, pass a comma-separated list.
720
721    extmod_whitelist : None
722        comma-separated list of modules to sync
723
724    extmod_blacklist : None
725        comma-separated list of modules to blacklist based on type
726
727    CLI Example:
728
729    .. code-block:: bash
730
731        salt-run saltutil.sync_roster
732    """
733    return salt.utils.extmods.sync(
734        __opts__,
735        "roster",
736        saltenv=saltenv,
737        extmod_whitelist=extmod_whitelist,
738        extmod_blacklist=extmod_blacklist,
739    )[0]
740
741
742def sync_eauth_tokens(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
743    """
744    .. versionadded:: 2018.3.0
745
746    Sync eauth token modules from ``salt://_tokens`` to the master
747
748    saltenv : base
749        The fileserver environment from which to sync. To sync from more than
750        one environment, pass a comma-separated list.
751
752    extmod_whitelist : None
753        comma-separated list of modules to sync
754
755    extmod_blacklist : None
756        comma-separated list of modules to blacklist based on type
757
758    CLI Example:
759
760    .. code-block:: bash
761
762        salt-run saltutil.sync_eauth_tokens
763    """
764    return salt.utils.extmods.sync(
765        __opts__,
766        "tokens",
767        saltenv=saltenv,
768        extmod_whitelist=extmod_whitelist,
769        extmod_blacklist=extmod_blacklist,
770    )[0]
771
772
773def sync_serializers(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
774    """
775    .. versionadded:: 2019.2.0
776
777    Sync serializer modules from ``salt://_serializers`` to the master
778
779    saltenv : base
780        The fileserver environment from which to sync. To sync from more than
781        one environment, pass a comma-separated list.
782
783    extmod_whitelist : None
784        comma-seperated list of modules to sync
785
786    extmod_blacklist : None
787        comma-seperated list of modules to blacklist based on type
788
789    CLI Example:
790
791    .. code-block:: bash
792
793        salt-run saltutil.sync_utils
794    """
795    return salt.utils.extmods.sync(
796        __opts__,
797        "serializers",
798        saltenv=saltenv,
799        extmod_whitelist=extmod_whitelist,
800        extmod_blacklist=extmod_blacklist,
801    )[0]
802
803
804def sync_executors(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
805    """
806    .. versionadded:: 3000
807
808    Sync executor modules from ``salt://_executors`` to the master
809
810    saltenv : base
811        The fileserver environment from which to sync. To sync from more than
812        one environment, pass a comma-separated list.
813
814    extmod_whitelist : None
815        comma-seperated list of modules to sync
816
817    extmod_blacklist : None
818        comma-seperated list of modules to blacklist based on type
819
820    CLI Example:
821
822    .. code-block:: bash
823
824        salt-run saltutil.sync_executors
825    """
826    return salt.utils.extmods.sync(
827        __opts__,
828        "executors",
829        saltenv=saltenv,
830        extmod_whitelist=extmod_whitelist,
831        extmod_blacklist=extmod_blacklist,
832    )[0]
833