mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ce_file_copy: fix broken import (#34023)
* fix broken import * doc: use formatting functions
This commit is contained in:
parent
663f8464ee
commit
4713d9ea44
2 changed files with 19 additions and 9 deletions
|
@ -32,30 +32,32 @@ author:
|
||||||
notes:
|
notes:
|
||||||
- The feature must be enabled with feature scp-server.
|
- The feature must be enabled with feature scp-server.
|
||||||
- If the file is already present, no transfer will take place.
|
- If the file is already present, no transfer will take place.
|
||||||
|
requirements:
|
||||||
|
- paramiko
|
||||||
options:
|
options:
|
||||||
local_file:
|
local_file:
|
||||||
description:
|
description:
|
||||||
- Path to local file. Local directory must exist.
|
- Path to local file. Local directory must exist.
|
||||||
The maximum length of local_file is 4096.
|
The maximum length of I(local_file) is C(4096).
|
||||||
required: true
|
required: true
|
||||||
remote_file:
|
remote_file:
|
||||||
description:
|
description:
|
||||||
- Remote file path of the copy. Remote directories must exist.
|
- Remote file path of the copy. Remote directories must exist.
|
||||||
If omitted, the name of the local file will be used.
|
If omitted, the name of the local file will be used.
|
||||||
The maximum length of remote_file is 4096.
|
The maximum length of I(remote_file) is C(4096).
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
file_system:
|
file_system:
|
||||||
description:
|
description:
|
||||||
- The remote file system of the device. If omitted,
|
- The remote file system of the device. If omitted,
|
||||||
devices that support a file_system parameter will use
|
devices that support a I(file_system) parameter will use
|
||||||
their default values.
|
their default values.
|
||||||
File system indicates the storage medium and can be set to as follows,
|
File system indicates the storage medium and can be set to as follows,
|
||||||
1) 'flash:' is root directory of the flash memory on the master MPU.
|
1) C(flash) is root directory of the flash memory on the master MPU.
|
||||||
2) 'slave#flash:' is root directory of the flash memory on the slave MPU.
|
2) C(slave#flash) is root directory of the flash memory on the slave MPU.
|
||||||
If no slave MPU exists, this drive is unavailable.
|
If no slave MPU exists, this drive is unavailable.
|
||||||
3) 'chassis ID/slot number#flash:' is root directory of the flash memory on
|
3) C(chassis ID/slot number#flash) is root directory of the flash memory on
|
||||||
a device in a stack. For example, 1/5#flash indicates the flash memory
|
a device in a stack. For example, C(1/5#flash) indicates the flash memory
|
||||||
whose chassis ID is 1 and slot number is 5.
|
whose chassis ID is 1 and slot number is 5.
|
||||||
required: false
|
required: false
|
||||||
default: 'flash:'
|
default: 'flash:'
|
||||||
|
@ -111,10 +113,15 @@ import re
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
import paramiko
|
|
||||||
from ansible.module_utils.basic import get_exception, AnsibleModule
|
from ansible.module_utils.basic import get_exception, AnsibleModule
|
||||||
from ansible.module_utils.network.cloudengine.ce import ce_argument_spec, run_commands, get_nc_config
|
from ansible.module_utils.network.cloudengine.ce import ce_argument_spec, run_commands, get_nc_config
|
||||||
|
|
||||||
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from scp import SCPClient
|
from scp import SCPClient
|
||||||
HAS_SCP = True
|
HAS_SCP = True
|
||||||
|
@ -327,6 +334,10 @@ class FileCopy(object):
|
||||||
self.module.fail_json(
|
self.module.fail_json(
|
||||||
msg="'Error: No scp package, please install it.'")
|
msg="'Error: No scp package, please install it.'")
|
||||||
|
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
self.module.fail_json(
|
||||||
|
msg="'Error: No paramiko package, please install it.'")
|
||||||
|
|
||||||
if self.local_file and len(self.local_file) > 4096:
|
if self.local_file and len(self.local_file) > 4096:
|
||||||
self.module.fail_json(
|
self.module.fail_json(
|
||||||
msg="'Error: The maximum length of local_file is 4096.'")
|
msg="'Error: The maximum length of local_file is 4096.'")
|
||||||
|
|
|
@ -10,7 +10,6 @@ lib/ansible/modules/cloud/webfaction/webfaction_db.py
|
||||||
lib/ansible/modules/cloud/webfaction/webfaction_domain.py
|
lib/ansible/modules/cloud/webfaction/webfaction_domain.py
|
||||||
lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py
|
lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py
|
||||||
lib/ansible/modules/cloud/webfaction/webfaction_site.py
|
lib/ansible/modules/cloud/webfaction/webfaction_site.py
|
||||||
lib/ansible/modules/network/cloudengine/ce_file_copy.py
|
|
||||||
lib/ansible/modules/network/ios/ios_static_route.py
|
lib/ansible/modules/network/ios/ios_static_route.py
|
||||||
lib/ansible/modules/network/lenovo/cnos_backup.py
|
lib/ansible/modules/network/lenovo/cnos_backup.py
|
||||||
lib/ansible/modules/network/lenovo/cnos_bgp.py
|
lib/ansible/modules/network/lenovo/cnos_bgp.py
|
||||||
|
|
Loading…
Add table
Reference in a new issue