Actions
Issue #5870
closedfile remotes with file:// urls pointing to a read-only directory fail to sync
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 63
Quarter:
Description
Steps to reproduce:
1. Create some file repository in /file
2. Set permissions on it:
chown root:root /file -R
chmod 755 /file -R
3. create a remote pointed to file:///file/PULP_MANIFEST
4. Sync the remote with repository
You will get an error:
traceback: |2
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 822, in perform_job
rv = job.perform()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 605, in perform
self._result = self._execute()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 611, in _execute
return self.func(*self.args, **self.kwargs)
File "/usr/local/lib/pulp/src/pulp-file/pulp_file/app/tasks/synchronizing.py", line 45, in synchronize
dv.create()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/plugin/stages/declarative_version.py", line 149, in create
loop.run_until_complete(pipeline)
File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 209, in create_pipeline
await asyncio.gather(*futures)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
await self.run()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/plugin/stages/artifact_stages.py", line 196, in run
d_artifact.artifact for d_artifact in da_to_save)):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/app/models/content.py", line 42, in bulk_get_or_create
return super().bulk_create(objs, batch_size=batch_size)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 468, in bulk_create
self._batched_insert(objs_with_pk, fields, batch_size, ignore_conflicts=ignore_conflicts)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 1204, in _batched_insert
ignore_conflicts=ignore_conflicts,
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 1186, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1334, in execute_sql
for sql, params in self.as_sql():
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1278, in as_sql
for obj in self.query.objs
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1278, in <listcomp>
for obj in self.query.objs
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1277, in <listcomp>
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1228, in pre_save_val
return field.pre_save(obj, add=True)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/app/models/fields.py", line 62, in pre_save
return super().pre_save(model_instance, add)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/fields/files.py", line 288, in pre_save
file.save(file.name, file.file, save=False)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/fields/files.py", line 87, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/app/models/storage.py", line 108, in save
return self._save(name, content)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/files/storage.py", line 261, in _save
file_move_safe(content.temporary_file_path(), full_path)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/files/move.py", line 80, in file_move_safe
os.remove(old_file_name)
description: "[Errno 30] Read-only file system: '/mnt/disk/file1/4.iso'"
if you chmod 777 /file, it syncs fine fine.
Actions
Copy files when they originate out of MEDIA_ROOT
Django would move files in cases where the source was a file:/// repository.
https://pulp.plan.io/issues/5941 closes #5941
https://pulp.plan.io/issues/5870 closes #5870