Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import does not find Access Layer File - [Errno 2] #95

Open
mhansi12 opened this issue Apr 17, 2024 · 0 comments
Open

Import does not find Access Layer File - [Errno 2] #95

mhansi12 opened this issue Apr 17, 2024 · 0 comments

Comments

@mhansi12
Copy link

mhansi12 commented Apr 17, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant