ExportImportPolicyPackage
ExportImportPolicyPackage copied to clipboard
Import does not find Access Layer File - [Errno 2]
Using ExportImportPolicyPackage V6, cp-api V1.8,
I have an R81.10 MDS enviroment, where I try to export a policy from one domain and import it to a newly created domain on the same MDS Server. ( this python script for "Export" and "Import" are running directly on the MDS server itself)
During import ( I get following "FileNotFoundError" ( replicable!) :
Importing Access_Layer [IMPORTED LAYER Network]
Traceback (most recent call last):
File "import_export_package.py", line 75, in <module>
import_package(client, args)
File "/home/admin/exportImportPolicyPackage6.0+cpi1.8/importing/import_package.py", line 56, in import_package
layers_to_attach = import_objects(args.file, client, {}, package, None, args)
File "/home/admin/exportImportPolicyPackage6.0+cpi1.8/importing/import_objects.py", line 208, in import_objects
import_objects(rulebase_object_file.name, client, changed_layer_names, package, layer_name, args)
File "/home/admin/exportImportPolicyPackage6.0+cpi1.8/importing/import_objects.py", line 66, in import_objects
export_tar = tarfile.open(file_name, "r:gz")
File "/opt/CPsuite-R81.10/fw1/Python/lib/python3.7/tarfile.py", line 1591, in open
return func(name, filemode, fileobj, **kwargs)
File "/opt/CPsuite-R81.10/fw1/Python/lib/python3.7/tarfile.py", line 1637, in gzopen
fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
File "/opt/CPsuite-R81.10/fw1/Python/lib/python3.7/gzip.py", line 168, in __init__
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'exported__access_layer__Network__2024_04_17_18_24.tar.gz'
I see in the background, that this file is deleted during import. But I do not understand the work flow of this tool.
What I recognized now during export( after I tried a second time), that there are two exact some export statements for the "customer1 Network" Layer:
1. Change Settings
2. Run
99. Exit
2
Exporting Access Control layers
**Exporting Access Layer [Network]**
Retrieved 28 out of 28 rules (100%)
Processing rules and sections
Exporting Inline-Layer [customer1 Network]
**Exporting Access Layer [customer1 Network]**
Retrieved 50 out of 402 rules (12%)
. . .
. . .
Done exporting layer 'customer1 Network'.
and a little later I got (again):
Exporting access rules from layer [Network]
Exporting access sections from layer [Network]
Exporting placeholders for unexportable objects from layer [Network]
Exporting layer settings of layer [Network]
Done exporting layer 'Network'.
**Exporting Access Layer [customer1 Network]**
Retrieved 50 out of 402 rules (12%)
Retrieved 100 out of 402 rules (24%)
Just recognized another hint/strange thing about my "Export" file: See the content of this TAR file from this export:
tar xvfz ../exported__package__customer1__2024_04_17_21_28.tar.gz
**exported__access_layer__customer1 Network__2024_04_17_21_28.tar.gz**
exported__access_layer__Network__2024_04_17_21_28.tar.gz
**exported__access_layer__customer1 Network__2024_04_17_21_28.tar.gz**
exported__nat_layer__customer1__2024_04_17_21_28.tar.gz
03____add-host__2024_04_17_21_28.csv
03____add-host__2024_04_17_21_28.json
04____add-network__2024_04_17_21_28.csv
04____add-network__2024_04_17_21_28.json`
. . .
Any ideas what is going wrong here ?
Thanks, Martin