Skip to content

Commit 072d954

Browse files
committed
(BOLT-1379) (docs) 'file upload' can handle directories
The 'file upload' command and the 'upload_file' function are able to upload directories as well as individual files - these changes explicitly mention that in the docs.
1 parent 46434af commit 072d954

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

bolt-modules/boltlib/lib/puppet/functions/upload_file.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#
88
# **NOTE:** Not available in apply block
99
Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunction) do
10-
# Upload a file.
11-
# @param source A source path, either an absolute path or a modulename/filename selector for a file in
12-
# <moduleroot>/files.
10+
# Upload a file or directory.
11+
# @param source A source path, either an absolute path or a modulename/filename selector for a
12+
# file or directory in <moduleroot>/files.
1313
# @param destination An absolute path on the target(s).
1414
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
1515
# @param options Additional options: '_catch_errors', '_run_as'.
@@ -27,9 +27,9 @@
2727
return_type 'ResultSet'
2828
end
2929

30-
# Upload a file, logging the provided description.
31-
# @param source A source path, either an absolute path or a modulename/filename selector for a file in
32-
# <moduleroot>/files.
30+
# Upload a file or directory, logging the provided description.
31+
# @param source A source path, either an absolute path or a modulename/filename selector for a
32+
# file or directory in <moduleroot>/files.
3333
# @param destination An absolute path on the target(s).
3434
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
3535
# @param description A description to be output when calling this function.

lib/bolt/bolt_option_parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def self.examples(cmd, desc)
2222
2323
Available subcommands:
2424
bolt command run <command> Run a command remotely
25-
bolt file upload <src> <dest> Upload a local file
25+
bolt file upload <src> <dest> Upload a local file or directory
2626
bolt script run <script> Upload a local script and run it remotely
2727
bolt task show Show list of available tasks
2828
bolt task show <task> Show documentation for task
@@ -93,7 +93,7 @@ def self.examples(cmd, desc)
9393
Usage: bolt file <action> [options]
9494
9595
Available actions are:
96-
upload <src> <dest> Upload local file <src> to <dest> on each node
96+
upload <src> <dest> Upload local file or directory <src> to <dest> on each node
9797
9898
#{examples('file upload /tmp/source /etc/profile.d/login.sh', 'upload a file to')}
9999
Available options are:

pre-docs/bolt_command_reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Bolt commands use the syntax: `bolt <subcommand> <action> [options]`
1313
| `bolt task run` | Runs a task on a remote system, passing any specified parameters. | - The task name, in the format `modulename::taskname`.<br>- The nodes on which to run the task.
1414
| `bolt plan run` | Runs a task plan. | - The plan name, in the format `modulename::planname`.<br>- The nodes on which to run the plan.
1515
| `bolt apply` | Applies a Puppet manifest file. | - The path to the manifest file.<br>- The nodes on which to run the plan.
16-
| `bolt file upload` | Uploads a local file to a remote node. | - The path to the source file.<br>- The path to the remote location.<br>- The nodes on which to upload the file.
16+
| `bolt file upload` | Uploads a local file or directory to a remote node. | - The path to the source file or directory.<br>- The path to the remote location.<br>- The nodes on which to upload the file or directory.
1717
| `bolt task show` | Lists all the tasks on the modulepath that have not been marked `private`. Will note whether a task supports no-operation mode. | - Adding a specific task name displays details and parameters for the task.<br>- Optionally, the name of a task you want details for: `bolt task show <TASK NAME>`
1818
| `bolt plan show` | Lists the plans that are installed on the current module path. | - Adding a specific plan name displays details and parameters for the plan.
1919
| `bolt plan convert` | Converts a YAML plan to a Puppet plan | - The path (relative or absolute) to the YAML plan to be converted.

pre-docs/plan_functions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,16 +645,16 @@ This function does nothing if the list of targets is empty.
645645
**NOTE:** Not available in apply block
646646

647647

648-
### Upload a file.
648+
### Upload a file or directory.
649649

650650
```
651651
upload_file(String[1] $source, String[1] $destination, Boltlib::TargetSpec $targets, Optional[Hash[String[1], Any]] $options)
652652
```
653653

654654
*Returns:* `ResultSet` A list of results, one entry per target.
655655

656-
* **source** `String[1]` A source path, either an absolute path or a modulename/filename selector for a file in
657-
<moduleroot>/files.
656+
* **source** `String[1]` A source path, either an absolute path or a modulename/filename selector for a
657+
file or directory in <moduleroot>/files.
658658
* **destination** `String[1]` An absolute path on the target(s).
659659
* **targets** `Boltlib::TargetSpec` A pattern identifying zero or more targets. See [`get_targets`](#get_targets) for accepted patterns.
660660
* **options** `Optional[Hash[String[1], Any]]` Additional options: '_catch_errors', '_run_as'.
@@ -668,16 +668,16 @@ upload_file('/var/tmp/payload.tgz', '/tmp/payload.tgz', $targets, '_run_as' => '
668668
upload_file('postgres/default.conf', 'C:/ProgramData/postgres/default.conf', $target)
669669
```
670670

671-
### Upload a file, logging the provided description.
671+
### Upload a file or directory, logging the provided description.
672672

673673
```
674674
upload_file(String[1] $source, String[1] $destination, Boltlib::TargetSpec $targets, String $description, Optional[Hash[String[1], Any]] $options)
675675
```
676676

677677
*Returns:* `ResultSet` A list of results, one entry per target.
678678

679-
* **source** `String[1]` A source path, either an absolute path or a modulename/filename selector for a file in
680-
<moduleroot>/files.
679+
* **source** `String[1]` A source path, either an absolute path or a modulename/filename selector for a
680+
file or directory in <moduleroot>/files.
681681
* **destination** `String[1]` An absolute path on the target(s).
682682
* **targets** `Boltlib::TargetSpec` A pattern identifying zero or more targets. See [`get_targets`](#get_targets) for accepted patterns.
683683
* **description** `String` A description to be output when calling this function.

pre-docs/running_bolt_commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ winrm:
9898
extensions: [.py, .pl]
9999
```
100100
101-
## Upload files to remote nodes
101+
## Upload files or directories to remote nodes
102102
103-
Use Bolt to copy files to remote nodes.
103+
Use Bolt to copy files or directories to remote nodes.
104104
105105
**Note:** Most transports are not optimized for file copying, so this command is best limited to small files.
106106
107-
- To upload a file to a remote node, run the `bolt file upload` command. Specify the local path to the file, the destination location, and the target nodes.
107+
- To upload a file or directory to a remote node, run the `bolt file upload` command. Specify the local path to the file or directory, the destination location, and the target nodes.
108108
109109
```
110110
bolt file upload <SOURCE> <DESTINATION> --nodes <NODE NAME>,<NODE NAME>

0 commit comments

Comments
 (0)