Katello does not create Puppet environment files on Content View promotion

Problem:
Katello does not create Puppet environment files on Content View promotion.
I can only see Puppet environments in Katello UI but these are not related with any files on host.
When I import Puppet classes it shows that the new environment is removed according to the state on host.
Please also check the attached screenshots.

What is the implemented behavior in content view promotion case and Puppet environment/modules ?

Expected behavior
Katello creates relevant files.

Foreman and Proxy versions:
Foreman 1.24

Foreman and Proxy plugin versions:
Katello 3.14

Distribution and version:
CentOS 7

Other relevant data:

@marcinmilewski Thank you for reaching out. I’ll try and get an answer for you ASAP.

2 Likes

@marcinmilewski i haven’t forgotten you, still working on finding someone who can help out with your issue.

1 Like

Can you confirm that that directory (/etc/puppetlabs/code/environments) is writable by apache?

Do you see any errors in /var/log/messages when doing a content view publish of that content view?

1 Like

Thank you for your help @jjeffers and @Justin_Sherrill.
I can confirm that /etc/puppetlabs/code/environments is writable by apache:

[centos@foreman ~]$ ls -la /etc/puppetlabs/code/environments
    total 0
    drwxr-xr-x. 4 apache root 36 04-17 00:14 .
    drwxr-xr-x. 4 root   root 39 04-16 23:58 ..
    drwxr-xr-x. 2 apache root  6 04-17 00:14 common
    drwxr-xr-x. 5 root   root 87 04-16 23:58 production

Also, don’t see any errors in /var/log/messeges (one thing I can see is 404 HTTP response code for /puppet/environments/KT_Default_Organization_dev_GitContentView_2/classes):

Logs
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._queue_reserved_task[61bb6821-22d8-4867-8c39-7f6bd766fc87]
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.managers.repo.unit_association.associate_from_repo[df04bd22-1a54-4b67-8545-211ffe6cf857]
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._release_resource[02901e3a-53bb-4bc7-967d-2049866a20ff]
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [61bb6821] Task pulp.server.async.tasks._queue_reserved_task[61bb6821-22d8-4867-8c39-7f6bd766fc87] succeeded in 0.02925956s: None
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [df04bd22] Task pulp.server.managers.repo.unit_association.associate_from_repo[df04bd22-1a54-4b67-8545-211ffe6cf857] succeeded in 0.0283528470001s: {'units_successful': [{'unit_key': {...}, 'type_id': 'puppet_module'}, {'unit_key': {...}, 'type_id': 'puppet_module'}]}
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [02901e3a] Task pulp.server.async.tasks._release_resource[02901e3a-53bb-4bc7-967d-2049866a20ff] succeeded in 0.00126901099998s: None
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._queue_reserved_task[05318aa9-9c25-4d7a-956a-e15244d04f31]
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.managers.repo.publish.publish[dc4d0d29-21c2-4934-a5e5-b6d8a96e6e73]
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [05318aa9] Task pulp.server.async.tasks._queue_reserved_task[05318aa9-9c25-4d7a-956a-e15244d04f31] succeeded in 0.01779762s: None
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._release_resource[2299270e-e69d-43af-b76a-1f0de1717a80]
Apr 28 01:40:00 foreman pulp: pulp_puppet.plugins.distributors.publish:INFO: [dc4d0d29] Beginning publish for repository <1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb>
Apr 28 01:40:00 foreman pulp: pulp_puppet.plugins.distributors.publish:INFO: [dc4d0d29] Initializing build directory for repository <1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb>
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._queue_reserved_task[eaa77a7e-6985-4f15-a4b7-7faa1c8cd36a]
Apr 28 01:40:00 foreman pulp: pulp_puppet.plugins.distributors.publish:INFO: [dc4d0d29] Creating symlinks for modules in repository <1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb>
Apr 28 01:40:00 foreman pulp: pulp_puppet.plugins.distributors.publish:INFO: [dc4d0d29] Generating metadata for repository <1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb>
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.managers.repo.publish.publish[f62c4f9c-ccae-4b1b-94b3-7b7275bf3619]
Apr 28 01:40:00 foreman pulp: pulp_puppet.plugins.distributors.publish:INFO: [dc4d0d29] Making newly built repository live for repository <1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb>
Apr 28 01:40:00 foreman pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._release_resource[d12432d1-0ebb-453c-af5a-f1a0c41ef988]
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [eaa77a7e] Task pulp.server.async.tasks._queue_reserved_task[eaa77a7e-6985-4f15-a4b7-7faa1c8cd36a] succeeded in 0.024446841s: None
Apr 28 01:40:00 foreman pulp: pulp_puppet.plugins.distributors.publish:INFO: [dc4d0d29] Cleaning up build directory for repository <1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb>
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [dc4d0d29] Task pulp.server.managers.repo.publish.publish[dc4d0d29-21c2-4934-a5e5-b6d8a96e6e73] succeeded in 0.0568741679999s: {'exception': None, 'repo_id': '1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb', 'traceback': None, 'started': '2020-04-28T05:40:00Z', '_ns': 'repo_publish_results', 'completed': datetime.datetime(2020, 4, 28, 5, 40, 0, 915237, tzinfo=<isodate.tzinfo.Utc object at 0x7f3ce3fd1f50>), 'error_message': None, 'distributor_type_id': 'puppet_distributor', 'distributor_id': '1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb_puppet', 'summary': {'total_execution_time': 0}, 'result': 'success', 'id': '5ea7c1b047917e09e34827bb', 'details': {}}
Apr 28 01:40:00 foreman pulp: celery.app.trace:INFO: [2299270e] Task pulp.server.async.tasks._release_resource[2299270e-e69d-43af-b76a-1f0de1717a80] succeeded in 0.00338046100001s: None
Apr 28 01:40:01 foreman pulp: celery.app.trace:INFO: [f62c4f9c] Task pulp.server.managers.repo.publish.publish[f62c4f9c-ccae-4b1b-94b3-7b7275bf3619] succeeded in 0.098415339s: {'exception': None, 'repo_id': '1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb', 'traceback': None, 'started': '2020-04-28T05:40:00Z', '_ns': 'repo_publish_results', 'completed': datetime.datetime(2020, 4, 28, 5, 40, 1, 38702, tzinfo=<isodate.tzinfo.Utc object at 0x7f3ce3fd1f50>), 'error_message': None, 'distributor_type_id': 'puppet_install_distributor', 'distributor_id': '1-GitContentView-dev-puppet-47668efd-abe3-4498-8d90-09e82f127adb', 'summary': 'success', 'result': 'success', 'id': '5ea7c1b147917e09e34827bc', 'details': {'errors': [], 'success_unit_keys': [{...}, {...}]}}
Apr 28 01:40:01 foreman pulp: celery.app.trace:INFO: [d12432d1] Task pulp.server.async.tasks._release_resource[d12432d1-0ebb-453c-af5a-f1a0c41ef988] succeeded in 0.00126588900002s: None
Apr 28 01:40:01 foreman smart-proxy: foreman.company.com - - [28/Apr/2020:01:40:01 EDT] "GET /puppet/environments/KT_Default_Organization_dev_GitContentView_2/classes HTTP/1.1" 404 73
Apr 28 01:40:01 foreman smart-proxy: - -> /puppet/environments/KT_Default_Organization_dev_GitContentView_2/classes
Apr 28 01:40:01 foreman smart-proxy: foreman.company.com - - [28/Apr/2020:01:40:01 EDT] "GET /puppet/environments HTTP/1.1" 200 23
Apr 28 01:40:01 foreman smart-proxy: - -> /puppet/environments
Apr 28 01:40:02 foreman smart-proxy: foreman.company.com - - [28/Apr/2020:01:40:01 EDT] "GET /puppet/environments HTTP/1.1" 200 23
Apr 28 01:40:02 foreman smart-proxy: - -> /puppet/environments
Apr 28 01:40:02 foreman smart-proxy: foreman.company.com - - [28/Apr/2020:01:40:02 EDT] "GET /puppet/environments HTTP/1.1" 200 23
Apr 28 01:40:02 foreman smart-proxy: - -> /puppet/environments

Can you also check:

 ls -ld /etc/puppetlabs/code/environments

This directory is owned by root and might be causing the issue. Sadly https://tickets.puppetlabs.com/browse/PA-2781 was closed as WONTFIX.

@Justin_Sherrill
[centos@foreman ~]$ ls -ld /etc/puppetlabs/code/environments
drwxr-xr-x. 4 apache root 36 04-17 00:14 /etc/puppetlabs/code/environments

@ekohl I just changed the owner of production directory to apache user but still it does not work unfortunately.
image

Could you provide the output of:

foreman-rake console
=> SmartProxy.all.map(&:puppet_path)

@Justin_Sherrill Sorry for the delay in answering.
This is the output:

[root@foreman centos]# foreman-rake console
Loading production environment (Rails 5.2.1)
irb(main):001:0> SmartProxy.all.map(&:puppet_path)
=> ["/tmp/kafo_installation20200417-14579-17ne049/environments"]
irb(main):002:0>

Any update on this please - I have the same issue

Hi @avisram

Welcome to the community!

There have been a lot of changes since the time this thread was opened.

Please start a new thread with the details of your deployments, your versions of Foreman and Katello /Plugins, and where you got stuck, which manual you used. We can better help you then!

1 Like

Thanks - will do

1 Like