openbolt 5.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Puppetfile +52 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +60 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/containerresult.rb +51 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/future.rb +25 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/resourceinstance.rb +71 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/result.rb +55 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +65 -0
- data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +93 -0
- data/bolt-modules/boltlib/lib/puppet/functions/add_facts.rb +33 -0
- data/bolt-modules/boltlib/lib/puppet/functions/add_to_group.rb +38 -0
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +208 -0
- data/bolt-modules/boltlib/lib/puppet/functions/background.rb +62 -0
- data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +57 -0
- data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +130 -0
- data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +31 -0
- data/bolt-modules/boltlib/lib/puppet/functions/fail_plan.rb +52 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_resources.rb +87 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_target.rb +34 -0
- data/bolt-modules/boltlib/lib/puppet/functions/get_targets.rb +35 -0
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +74 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_command.rb +97 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_fact.rb +47 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +52 -0
- data/bolt-modules/boltlib/lib/puppet/functions/remove_from_group.rb +40 -0
- data/bolt-modules/boltlib/lib/puppet/functions/resolve_references.rb +42 -0
- data/bolt-modules/boltlib/lib/puppet/functions/resource.rb +53 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +106 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_container.rb +162 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_plan.rb +291 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +145 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +164 -0
- data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +211 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_config.rb +48 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +43 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_resources.rb +145 -0
- data/bolt-modules/boltlib/lib/puppet/functions/set_var.rb +38 -0
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +101 -0
- data/bolt-modules/boltlib/lib/puppet/functions/vars.rb +29 -0
- data/bolt-modules/boltlib/lib/puppet/functions/wait.rb +131 -0
- data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +59 -0
- data/bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb +39 -0
- data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +50 -0
- data/bolt-modules/boltlib/types/planresult.pp +18 -0
- data/bolt-modules/boltlib/types/targetspec.pp +7 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +42 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/sleep.rb +20 -0
- data/bolt-modules/dir/lib/puppet/functions/dir/children.rb +35 -0
- data/bolt-modules/file/lib/puppet/functions/file/delete.rb +21 -0
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +28 -0
- data/bolt-modules/file/lib/puppet/functions/file/join.rb +20 -0
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +33 -0
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +28 -0
- data/bolt-modules/file/lib/puppet/functions/file/write.rb +24 -0
- data/bolt-modules/log/lib/puppet/functions/log/debug.rb +39 -0
- data/bolt-modules/log/lib/puppet/functions/log/error.rb +40 -0
- data/bolt-modules/log/lib/puppet/functions/log/fatal.rb +40 -0
- data/bolt-modules/log/lib/puppet/functions/log/info.rb +39 -0
- data/bolt-modules/log/lib/puppet/functions/log/trace.rb +39 -0
- data/bolt-modules/log/lib/puppet/functions/log/warn.rb +41 -0
- data/bolt-modules/out/lib/puppet/functions/out/message.rb +36 -0
- data/bolt-modules/out/lib/puppet/functions/out/verbose.rb +35 -0
- data/bolt-modules/prompt/lib/puppet/functions/prompt/menu.rb +103 -0
- data/bolt-modules/prompt/lib/puppet/functions/prompt.rb +65 -0
- data/bolt-modules/system/lib/puppet/functions/system/env.rb +20 -0
- data/exe/bolt +17 -0
- data/guides/debugging.yaml +27 -0
- data/guides/inventory.yaml +23 -0
- data/guides/links.yaml +12 -0
- data/guides/logging.yaml +17 -0
- data/guides/module.yaml +18 -0
- data/guides/modulepath.yaml +24 -0
- data/guides/project.yaml +21 -0
- data/guides/targets.yaml +28 -0
- data/guides/transports.yaml +22 -0
- data/lib/bolt/analytics.rb +233 -0
- data/lib/bolt/application.rb +806 -0
- data/lib/bolt/applicator.rb +368 -0
- data/lib/bolt/apply_inventory.rb +93 -0
- data/lib/bolt/apply_result.rb +154 -0
- data/lib/bolt/apply_target.rb +90 -0
- data/lib/bolt/bolt_option_parser.rb +1226 -0
- data/lib/bolt/catalog/logging.rb +15 -0
- data/lib/bolt/catalog.rb +144 -0
- data/lib/bolt/cli.rb +949 -0
- data/lib/bolt/config/modulepath.rb +30 -0
- data/lib/bolt/config/options.rb +673 -0
- data/lib/bolt/config/transport/base.rb +133 -0
- data/lib/bolt/config/transport/docker.rb +34 -0
- data/lib/bolt/config/transport/jail.rb +33 -0
- data/lib/bolt/config/transport/local.rb +39 -0
- data/lib/bolt/config/transport/lxd.rb +34 -0
- data/lib/bolt/config/transport/options.rb +431 -0
- data/lib/bolt/config/transport/orch.rb +41 -0
- data/lib/bolt/config/transport/podman.rb +33 -0
- data/lib/bolt/config/transport/remote.rb +24 -0
- data/lib/bolt/config/transport/ssh.rb +138 -0
- data/lib/bolt/config/transport/winrm.rb +63 -0
- data/lib/bolt/config.rb +515 -0
- data/lib/bolt/container_result.rb +105 -0
- data/lib/bolt/error.rb +194 -0
- data/lib/bolt/executor.rb +539 -0
- data/lib/bolt/fiber_executor.rb +190 -0
- data/lib/bolt/inventory/group.rb +446 -0
- data/lib/bolt/inventory/inventory.rb +391 -0
- data/lib/bolt/inventory/options.rb +139 -0
- data/lib/bolt/inventory/target.rb +293 -0
- data/lib/bolt/inventory.rb +120 -0
- data/lib/bolt/logger.rb +252 -0
- data/lib/bolt/module.rb +54 -0
- data/lib/bolt/module_installer/installer.rb +44 -0
- data/lib/bolt/module_installer/puppetfile/forge_module.rb +54 -0
- data/lib/bolt/module_installer/puppetfile/git_module.rb +37 -0
- data/lib/bolt/module_installer/puppetfile/module.rb +26 -0
- data/lib/bolt/module_installer/puppetfile.rb +131 -0
- data/lib/bolt/module_installer/resolver.rb +129 -0
- data/lib/bolt/module_installer/specs/forge_spec.rb +91 -0
- data/lib/bolt/module_installer/specs/git_spec.rb +150 -0
- data/lib/bolt/module_installer/specs/id/base.rb +116 -0
- data/lib/bolt/module_installer/specs/id/gitclone.rb +120 -0
- data/lib/bolt/module_installer/specs/id/github.rb +90 -0
- data/lib/bolt/module_installer/specs/id/gitlab.rb +92 -0
- data/lib/bolt/module_installer/specs.rb +95 -0
- data/lib/bolt/module_installer.rb +208 -0
- data/lib/bolt/node/errors.rb +55 -0
- data/lib/bolt/node/output.rb +29 -0
- data/lib/bolt/outputter/human.rb +958 -0
- data/lib/bolt/outputter/json.rb +205 -0
- data/lib/bolt/outputter/logger.rb +76 -0
- data/lib/bolt/outputter/rainbow.rb +118 -0
- data/lib/bolt/outputter.rb +57 -0
- data/lib/bolt/pal/issues.rb +19 -0
- data/lib/bolt/pal/logging.rb +17 -0
- data/lib/bolt/pal/yaml_plan/evaluator.rb +83 -0
- data/lib/bolt/pal/yaml_plan/loader.rb +94 -0
- data/lib/bolt/pal/yaml_plan/parameter.rb +63 -0
- data/lib/bolt/pal/yaml_plan/step/command.rb +45 -0
- data/lib/bolt/pal/yaml_plan/step/download.rb +37 -0
- data/lib/bolt/pal/yaml_plan/step/eval.rb +42 -0
- data/lib/bolt/pal/yaml_plan/step/message.rb +31 -0
- data/lib/bolt/pal/yaml_plan/step/plan.rb +42 -0
- data/lib/bolt/pal/yaml_plan/step/resources.rb +170 -0
- data/lib/bolt/pal/yaml_plan/step/script.rb +62 -0
- data/lib/bolt/pal/yaml_plan/step/task.rb +42 -0
- data/lib/bolt/pal/yaml_plan/step/upload.rb +37 -0
- data/lib/bolt/pal/yaml_plan/step/verbose.rb +31 -0
- data/lib/bolt/pal/yaml_plan/step.rb +223 -0
- data/lib/bolt/pal/yaml_plan/transpiler.rb +90 -0
- data/lib/bolt/pal/yaml_plan.rb +172 -0
- data/lib/bolt/pal.rb +847 -0
- data/lib/bolt/plan_creator.rb +219 -0
- data/lib/bolt/plan_future.rb +86 -0
- data/lib/bolt/plan_result.rb +44 -0
- data/lib/bolt/plugin/cache.rb +76 -0
- data/lib/bolt/plugin/env_var.rb +54 -0
- data/lib/bolt/plugin/module.rb +276 -0
- data/lib/bolt/plugin/prompt.rb +36 -0
- data/lib/bolt/plugin/puppet_connect_data.rb +84 -0
- data/lib/bolt/plugin/puppetdb.rb +124 -0
- data/lib/bolt/plugin/task.rb +72 -0
- data/lib/bolt/plugin.rb +380 -0
- data/lib/bolt/project.rb +219 -0
- data/lib/bolt/project_manager/config_migrator.rb +113 -0
- data/lib/bolt/project_manager/inventory_migrator.rb +67 -0
- data/lib/bolt/project_manager/migrator.rb +39 -0
- data/lib/bolt/project_manager/module_migrator.rb +203 -0
- data/lib/bolt/project_manager.rb +221 -0
- data/lib/bolt/puppetdb/client.rb +153 -0
- data/lib/bolt/puppetdb/config.rb +176 -0
- data/lib/bolt/puppetdb/instance.rb +146 -0
- data/lib/bolt/puppetdb.rb +15 -0
- data/lib/bolt/r10k_log_proxy.rb +30 -0
- data/lib/bolt/rerun.rb +55 -0
- data/lib/bolt/resource_instance.rb +133 -0
- data/lib/bolt/result.rb +247 -0
- data/lib/bolt/result_set.rb +128 -0
- data/lib/bolt/shell/bash/tmpdir.rb +62 -0
- data/lib/bolt/shell/bash.rb +516 -0
- data/lib/bolt/shell/powershell/snippets.rb +181 -0
- data/lib/bolt/shell/powershell.rb +365 -0
- data/lib/bolt/shell.rb +105 -0
- data/lib/bolt/target.rb +174 -0
- data/lib/bolt/task/puppet_server.rb +27 -0
- data/lib/bolt/task/run.rb +55 -0
- data/lib/bolt/task.rb +163 -0
- data/lib/bolt/transport/base.rb +252 -0
- data/lib/bolt/transport/docker/connection.rb +150 -0
- data/lib/bolt/transport/docker.rb +23 -0
- data/lib/bolt/transport/jail/connection.rb +81 -0
- data/lib/bolt/transport/jail.rb +21 -0
- data/lib/bolt/transport/local/connection.rb +106 -0
- data/lib/bolt/transport/local.rb +20 -0
- data/lib/bolt/transport/lxd/connection.rb +115 -0
- data/lib/bolt/transport/lxd.rb +26 -0
- data/lib/bolt/transport/orch/connection.rb +111 -0
- data/lib/bolt/transport/orch.rb +271 -0
- data/lib/bolt/transport/podman/connection.rb +102 -0
- data/lib/bolt/transport/podman.rb +19 -0
- data/lib/bolt/transport/remote.rb +41 -0
- data/lib/bolt/transport/simple.rb +54 -0
- data/lib/bolt/transport/ssh/connection.rb +321 -0
- data/lib/bolt/transport/ssh/exec_connection.rb +140 -0
- data/lib/bolt/transport/ssh.rb +48 -0
- data/lib/bolt/transport/winrm/connection.rb +378 -0
- data/lib/bolt/transport/winrm.rb +33 -0
- data/lib/bolt/util/format.rb +68 -0
- data/lib/bolt/util/puppet_log_level.rb +21 -0
- data/lib/bolt/util.rb +465 -0
- data/lib/bolt/validator.rb +227 -0
- data/lib/bolt/version.rb +5 -0
- data/lib/bolt.rb +8 -0
- data/lib/bolt_server/acl.rb +39 -0
- data/lib/bolt_server/base_config.rb +112 -0
- data/lib/bolt_server/config.rb +64 -0
- data/lib/bolt_server/file_cache.rb +200 -0
- data/lib/bolt_server/request_error.rb +11 -0
- data/lib/bolt_server/schemas/action-check_node_connections.json +14 -0
- data/lib/bolt_server/schemas/action-run_command.json +12 -0
- data/lib/bolt_server/schemas/action-run_script.json +47 -0
- data/lib/bolt_server/schemas/action-run_task.json +20 -0
- data/lib/bolt_server/schemas/action-upload_file.json +47 -0
- data/lib/bolt_server/schemas/partials/target-any.json +10 -0
- data/lib/bolt_server/schemas/partials/target-ssh.json +88 -0
- data/lib/bolt_server/schemas/partials/target-winrm.json +67 -0
- data/lib/bolt_server/schemas/partials/task.json +94 -0
- data/lib/bolt_server/schemas/transport-ssh.json +25 -0
- data/lib/bolt_server/schemas/transport-winrm.json +19 -0
- data/lib/bolt_server/transport_app.rb +554 -0
- data/lib/bolt_spec/bolt_context.rb +226 -0
- data/lib/bolt_spec/plans/action_stubs/command_stub.rb +51 -0
- data/lib/bolt_spec/plans/action_stubs/download_stub.rb +66 -0
- data/lib/bolt_spec/plans/action_stubs/plan_stub.rb +55 -0
- data/lib/bolt_spec/plans/action_stubs/script_stub.rb +59 -0
- data/lib/bolt_spec/plans/action_stubs/task_stub.rb +57 -0
- data/lib/bolt_spec/plans/action_stubs/upload_stub.rb +65 -0
- data/lib/bolt_spec/plans/action_stubs.rb +196 -0
- data/lib/bolt_spec/plans/mock_executor.rb +361 -0
- data/lib/bolt_spec/plans/publish_stub.rb +49 -0
- data/lib/bolt_spec/plans.rb +190 -0
- data/lib/bolt_spec/run.rb +246 -0
- data/lib/logging_extensions/logging.rb +13 -0
- data/libexec/apply_catalog.rb +130 -0
- data/libexec/bolt_catalog +68 -0
- data/libexec/custom_facts.rb +63 -0
- data/libexec/query_resources.rb +75 -0
- data/modules/aggregate/lib/puppet/functions/aggregate/count.rb +21 -0
- data/modules/aggregate/lib/puppet/functions/aggregate/nodes.rb +22 -0
- data/modules/aggregate/lib/puppet/functions/aggregate/targets.rb +21 -0
- data/modules/aggregate/plans/count.pp +56 -0
- data/modules/aggregate/plans/targets.pp +56 -0
- data/modules/canary/lib/puppet/functions/canary/merge.rb +13 -0
- data/modules/canary/lib/puppet/functions/canary/random_split.rb +22 -0
- data/modules/canary/lib/puppet/functions/canary/skip.rb +25 -0
- data/modules/canary/plans/init.pp +100 -0
- data/modules/puppet_connect/plans/test_input_data.pp +94 -0
- data/modules/puppetdb_fact/plans/init.pp +20 -0
- data/resources/bolt_bash_completion.sh +214 -0
- metadata +735 -0
@@ -0,0 +1,214 @@
|
|
1
|
+
#####################################################################
|
2
|
+
###
|
3
|
+
### Bash autocompletion for bolt
|
4
|
+
### include this file in your .bash_profile or .bashrc to use completion
|
5
|
+
### "source bolt_bash_completion.sh"
|
6
|
+
###
|
7
|
+
### Marc Schoechlin ms-github@256bit.org
|
8
|
+
|
9
|
+
get_json_keys() {
|
10
|
+
/opt/puppetlabs/bolt/bin/ruby <<-EOF
|
11
|
+
require 'json'
|
12
|
+
data = JSON.parse(File.read("${1}"))
|
13
|
+
puts data.keys.uniq.sort.join(' ')
|
14
|
+
EOF
|
15
|
+
}
|
16
|
+
|
17
|
+
_bolt_complete() {
|
18
|
+
local prev
|
19
|
+
local cur
|
20
|
+
# Get the current word and previous word without colons
|
21
|
+
_get_comp_words_by_ref -n : cur
|
22
|
+
_get_comp_words_by_ref -n : prev
|
23
|
+
|
24
|
+
local next=""
|
25
|
+
local subcommand=${COMP_WORDS[1]}
|
26
|
+
[[ ${#COMP_WORDS[@]} -gt 2 ]] && local action=${COMP_WORDS[2]}
|
27
|
+
local context_opts="-m --modulepath --project"
|
28
|
+
local global_opts="--clear-cache -h --help --log-level --version"
|
29
|
+
local inventory_opts="-q --query --rerun -t --targets"
|
30
|
+
local authentication_opts="-u --user -p --password --password-prompt --private-key --host-key-check --no-host-key-check --ssl --no-ssl --ssl-verify --no-ssl-verify"
|
31
|
+
local escalation_opts="--run-as --sudo-password --sudo-password-prompt --sudo-executable"
|
32
|
+
local run_context_opts="-c --concurrency -i --inventoryfile --save-rerun --no-save-rerun --cleanup --no-cleanup"
|
33
|
+
local transport_opts="--transport --connect-timeout --tty --no-tty --native-ssh --no-native-ssh --ssh-command --copy-command"
|
34
|
+
local display_opts="--format --color --no-color -v --verbose --no-verbose --trace --stream"
|
35
|
+
local action_opts="${inventory_opts} ${context_opts} ${authentication_opts} ${escalation_opts} ${run_context_opts} ${transport_opts} ${display_opts}"
|
36
|
+
local apply_opts="--compile-concurrency --hiera-config"
|
37
|
+
local file_opts=" -m --modulepath --project --private-key -i --inventoryfile --hiera-config "
|
38
|
+
|
39
|
+
# If there's only one word and it's "bolt", tab complete the subcommand
|
40
|
+
if [ $COMP_CWORD -eq 1 ]; then
|
41
|
+
next="apply command file group guide inventory lookup module plan plugin project script secret task"
|
42
|
+
fi
|
43
|
+
|
44
|
+
# Tab complete files for options that accept files. The spaces are important!
|
45
|
+
# They make it so `bolt inventory` isn't confused with `--inventoryfile`.
|
46
|
+
if [[ $file_opts =~ " ${prev} " ]]; then
|
47
|
+
next=$(compgen -f -d "" -- $cur)
|
48
|
+
# Handle tab completing enumerable CLI options
|
49
|
+
elif [ "$prev" == "--log-level" ]; then
|
50
|
+
next="trace debug info warn error fatal"
|
51
|
+
elif [ "$prev" == "--transport" ]; then
|
52
|
+
next="docker local lxd pcp podman remote ssh winrm"
|
53
|
+
elif [ "$prev" == "--format" ]; then
|
54
|
+
next="human json rainbow"
|
55
|
+
else
|
56
|
+
# Once we have subcommands, tab complete actions
|
57
|
+
case $subcommand in
|
58
|
+
apply)
|
59
|
+
next="${action_opts} ${apply_opts} -e --execute"
|
60
|
+
;;
|
61
|
+
command)
|
62
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
63
|
+
next="run"
|
64
|
+
elif [ $action = "run" ]; then
|
65
|
+
next="${action_opts} --env-var"
|
66
|
+
fi
|
67
|
+
;;
|
68
|
+
file)
|
69
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
70
|
+
next="download upload"
|
71
|
+
else
|
72
|
+
case $action in
|
73
|
+
download) next="${action_opts} --tmpdir";;
|
74
|
+
upload) next=$action_opts;;
|
75
|
+
esac
|
76
|
+
fi
|
77
|
+
;;
|
78
|
+
group)
|
79
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
80
|
+
next="show"
|
81
|
+
elif [ $action == 'show' ]; then
|
82
|
+
next="--project --format --inventoryfile"
|
83
|
+
fi
|
84
|
+
;;
|
85
|
+
guide)
|
86
|
+
next="--format"
|
87
|
+
;;
|
88
|
+
inventory)
|
89
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
90
|
+
next="show"
|
91
|
+
elif [ $action == 'show' ]; then
|
92
|
+
next="${inventory_opts} --project --format --inventoryfile --detail"
|
93
|
+
fi
|
94
|
+
;;
|
95
|
+
lookup)
|
96
|
+
next="${action_opts} --hiera-config --plan-hierarchy"
|
97
|
+
;;
|
98
|
+
module)
|
99
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
100
|
+
next="add generate-types install show"
|
101
|
+
else
|
102
|
+
case $action in
|
103
|
+
add | install) next="--project";;
|
104
|
+
generate-types) next="${context_opts}";;
|
105
|
+
show) next="${context_opts} --filter --format";;
|
106
|
+
esac
|
107
|
+
fi
|
108
|
+
;;
|
109
|
+
plan)
|
110
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
111
|
+
next="convert new run show"
|
112
|
+
elif [[ ($COMP_CWORD -eq 3 || \
|
113
|
+
( $COMP_CWORD -eq 4 && "$cur" == *"::" ) || \
|
114
|
+
( $COMP_CWORD -eq 5 && "$cur" == *"::"* )) &&
|
115
|
+
$action != "new" ]]; then
|
116
|
+
|
117
|
+
if [ -f "${PWD}/.plan_cache.json" ]; then
|
118
|
+
# Use Puppet's ruby instead of jq since we know it will be there.
|
119
|
+
next=$(get_json_keys "${PWD}/.plan_cache.json")
|
120
|
+
elif [ -f "${HOME}/.puppetlabs/bolt/.plan_cache.json" ]; then
|
121
|
+
next=$(get_json_keys "${HOME}/.puppetlabs/bolt/.plan_cache.json")
|
122
|
+
else
|
123
|
+
case $action in
|
124
|
+
convert) next="${context_opts}";;
|
125
|
+
new) next="--project --pp";;
|
126
|
+
run) next="${action_opts} ${apply_opts} --params --tmpdir";;
|
127
|
+
show) next="${context_opts} --filter --format";;
|
128
|
+
esac
|
129
|
+
fi
|
130
|
+
else
|
131
|
+
case $action in
|
132
|
+
convert) next="${context_opts}";;
|
133
|
+
new) next="--project --pp";;
|
134
|
+
run) next="${action_opts} ${apply_opts} --params --tmpdir";;
|
135
|
+
show) next="${context_opts} --filter --format";;
|
136
|
+
esac
|
137
|
+
fi
|
138
|
+
;;
|
139
|
+
plugin)
|
140
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
141
|
+
next="show"
|
142
|
+
else
|
143
|
+
next="${context_opts} --format --color --no-color"
|
144
|
+
fi
|
145
|
+
;;
|
146
|
+
project)
|
147
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
148
|
+
next="init migrate"
|
149
|
+
else
|
150
|
+
case $action in
|
151
|
+
init) next="--modules";;
|
152
|
+
migrate) next="--project --inventoryfile";;
|
153
|
+
esac
|
154
|
+
fi
|
155
|
+
;;
|
156
|
+
script)
|
157
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
158
|
+
next="run"
|
159
|
+
elif [[ $COMP_CWORD -eq 3 && $action == 'run' ]]; then
|
160
|
+
# List files and directories
|
161
|
+
next=$(compgen -f -d "" -- $cur)
|
162
|
+
elif [ $action == 'run' ]; then
|
163
|
+
next="${action_opts} --env-var --tmpdir"
|
164
|
+
fi
|
165
|
+
;;
|
166
|
+
secret)
|
167
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
168
|
+
next="createkeys encrypt decrypt"
|
169
|
+
else
|
170
|
+
case $action in
|
171
|
+
createkeys) next="${context_opts} --plugin --force";;
|
172
|
+
encrypt | decrypt) next="${context_opts} --plugin";;
|
173
|
+
esac
|
174
|
+
fi
|
175
|
+
;;
|
176
|
+
task)
|
177
|
+
if [ $COMP_CWORD -eq 2 ]; then
|
178
|
+
next="run show"
|
179
|
+
elif [[ $COMP_CWORD -eq 3 || \
|
180
|
+
( $COMP_CWORD -eq 4 && "$cur" == *"::" ) || \
|
181
|
+
( $COMP_CWORD -eq 5 && "$cur" == *"::"* ) ]]; then
|
182
|
+
if [ -f "${PWD}/.task_cache.json" ]; then
|
183
|
+
# Use Puppet's ruby instead of jq since we know it will be there.
|
184
|
+
next=$(get_json_keys "${PWD}/.task_cache.json")
|
185
|
+
elif [ -f "${HOME}/.puppetlabs/bolt/.task_cache.json" ]; then
|
186
|
+
next=$(get_json_keys "${HOME}/.puppetlabs/bolt/.task_cache.json")
|
187
|
+
else
|
188
|
+
case $action in
|
189
|
+
run) next="${action_opts} --env-var --tmpdir";;
|
190
|
+
show) next="${context_opts} --filter --format";;
|
191
|
+
esac
|
192
|
+
fi
|
193
|
+
else
|
194
|
+
case $action in
|
195
|
+
run) next="${action_opts} --env-var --tmpdir";;
|
196
|
+
show) next="${context_opts} --filter --format";;
|
197
|
+
esac
|
198
|
+
fi
|
199
|
+
;;
|
200
|
+
esac
|
201
|
+
fi
|
202
|
+
|
203
|
+
# If any of the next options are flags, we've reached the end of the
|
204
|
+
# building-a-Bolt-command part and can re-enable file and directory name
|
205
|
+
# completion and include Bolt's global flags.
|
206
|
+
if [[ "$next" =~ "--" ]]; then
|
207
|
+
next+=" ${global_opts}"
|
208
|
+
fi
|
209
|
+
|
210
|
+
COMPREPLY=($(compgen -W "$next" -- $cur))
|
211
|
+
__ltrim_colon_completions $cur
|
212
|
+
}
|
213
|
+
|
214
|
+
complete -F _bolt_complete bolt
|