This message was deleted.
# puppet-enterprise
s
This message was deleted.
b
Also I cannot reproduce this. I can create an environment, create a matching environment node group, delete the environment, delete the node group, the environment is gone again from the dropdown
s
huh, that’s strange, what does the env endpoint return?
b
It doenst list the two environments
s
is it possible that someone did a PUT to
classifier-api/v1/environments/<name>
?
b
mhm maybe
but how do I delete it? :D I think DELETE isnt supported on that endloint
s
yeah, not documented at least 😉 👀
b
I can give it a try tomorrow :D
s
Just looked at the in-repo docs, no delete 😉
b
what if I create that env in the control repo and delete it afterwards :D
s
that might just work 😉
b
will give it a try and update you
s
👍
So, this is completely undocumented, and not tested extensively, but you can delete an environment with the classifier API:
I think it should be safe 🙂
j
The classifier should purge an environment when an puppetserver returns a 404 from an
environment_classes
request, which should happen as part of a normal class update.
The classifier doesn’t log a lot, but any failures should be logged in the console-services.log at the “info” level at least.
b
@jonathan.newman it didn't purge the env. Output from the orchestration logs after I triggered a class update:
Copy code
2023-01-30T15:01:24.304+01:00 [qtp2010293914-150] INFO  [p.c.class-updater] Requesting classes in bld_krn2 from https://***:8140/puppet/v3/environment_classes?environment=bld_krn2
2023-01-30T15:01:24.350+01:00 [qtp2010293914-150] WARN  [p.c.class-updater] 404 response received for request for classes in bld_krn2.
2023-01-30T15:01:24.416+01:00 [qtp2010293914-150] INFO  [p.c.class-updater] Synchronized 1 classes for environment bld_krn2 from the Puppet server in 0 seconds
@steveax that worked. maybe a good thing for the docs? Or isn't this supposed to be a public API?
j
It is an internal testing API. Deleting environments that are in active use can have less than great side effects.
This sounds like a bug though. Can you do me a favor and check in the postgres logs for those time ranges and see if any errors/conflicts show up there? I’m opening a ticket for adding more logging to help diagnose these issues better in the future.
b
let me check
j
It could also be that there is a node group that is using that environment and assigning a class from it.
That is likely the cause.
b
I thought so as well, but didn't find one. but I think I've an old export of the node groups, let me grep through it
j
👍
More logging will certainly help with this too, so I’ll make sure that happens.
Thank you.
b
nothing in the postgresql logs that matches the environment names
j
Thanks for checking.
b
I don't have a recent node group dump. in very old ones there's no mention of a node group that uses classes from those to environments
Synchronized 1 classes for environment bld_krn2 from the Puppet server in 0 seconds
I'm not sure if that's an off by one error. otherwise it would be interesting to know which class that was. because orchestrator logged also that the environment doesn't even exist
j
The classifier maintains its own cache of classes, and if a node-group references a class that is deleted, that is maintained in the cache in a “deleted” state so we can show it in the UI as being removed (so there isn’t any mystery as to why the class suddenly disappeared). That “deleted” state is what I think was causing that behavior.
b
ah yeah