Description of problem: The import from local directory through API calls isnt functinal, its throwing directory not found error as following : --------------------------------------------------- "message":"Something went wrong during export: Using file-based synchronization, but couldn't find /tmp/now"} --------------------------------------------------- Here '/tmp/now' folder is created and with right permissions still the issue is misleading. Version-Release number of selected component (if applicable): Satellite 6.4.0 snap 2 How reproducible: Always Steps to Reproduce: 1. Create a local directory in satellite with foreman owner and correct SELinux policy 2. Create template erb file in that directory 3. Set that directory as 'Repo' in settings 4. Attempt to import above template from API end: # curl -H "Accept: application/json" -H "Content-Type: application/json" -k -X POST -u admin:passwd https://mysatellite.com/api/v2/templates/export -d '{"verbose": "true", "associate": "new"}' Actual results: {"message":"Something went wrong during export: Using file-based synchronization, but couldn't find /tmp/now"} Expected results: The template should be imported. Additional info:
Jitendra, please try using other directories than /tmp, I have a suspicion that it does not work because of private tmp. See https://www.theforeman.org/plugins/foreman_templates/5.0/index.html#7.3.1Yousettherepoto/tmpbutdon%E2%80%99tseeanythingnewaddedevenafterexportsaysSuccess for more details, I think that should be covered in product documentation (worth of checking though). If other directories work, I think this should not be blocker and perhaps even go to backlog or be closed as wontfix.
Marek, I check that by importing from /root/testTemplate/myTemplate directory, I faced same issue: -------------------- { "error": {"message":"Using file-based synchronization, but couldn't find /root/testTemplate/myTemplate"} } -------------------- But, interestingly when I tried keeping in /usr/share/jitu/ it just worked, -------------------- {"message":{"templates":[{"name":"jyejares provisionTemplate fake","id":511,"changed":false,"imported":true,"additional_errors":null,"exception":null,"validation_errors":{},"file":"testProviTable.erb","type":"provisioning_template","diff":null}],"repo":"/usr/share/jitu","branch":""}} ------------------- So, I think we need to confirm whether it should be /usr/share always or its a bug ?
The fact that you were able to export to /usr/share makes me think this is a permissions issue. You probably cannot export to /root/ because the system user that runs the application is not allowed to write there. It does not have to be /usr/share always, but the directory should be writeable imho. If it is really a permission issue, we should probably improve the message to let the user know what is going on...
If that's the case, this shouldn't be a blocker, Jitendra, could you please confirm? Note that the export is running under smart-proxy user and SELinux might also be blocking write access.
Created redmine issue http://projects.theforeman.org/issues/23958 from this bug
Upstream bug assigned to oprazak
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23958 has been resolved.
Verified ! @ satellite 6.4 snap 11 Steps: 1. Attempt to, Import in or export templates to non /usr/share directory. Behavior: The correct error message is diplayed informing user about permissions. { "error": {"message":"Using file-based synchronization, but couldn't access /root/rootDir/impDir to export templates. Please check the access permissions/SELinux and make sure it is writable for the web application user account, typically 'satellite'."} }
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:2927