-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add missing dependencies to allow repo initialization on first puppet run. #178
Conversation
Puppet, at least version 3.8.5, does not evaluate environment variable strings for variable expansion, which was leading to a PYTHONPATH variable of `/home/jenkins-agent/reprepro-updater/src:$PYTHONPATH` with a literal $PYTHONPATH. I think this is interfering with the default path and causing #174
@@ -210,7 +210,7 @@ | |||
exec {'init_main_repo': | |||
path => '/bin:/usr/bin', | |||
command => "/home/${agent_username}/reprepro-updater/scripts/setup_repo.py ubuntu_main -c", | |||
environment => ["PYTHONPATH=/home/${agent_username}/reprepro-updater/src:\$PYTHONPATH"], | |||
environment => ["PYTHONPATH=/home/${agent_username}/reprepro-updater/src"], | |||
user => $agent_username, | |||
group => $agent_username, | |||
unless => "/home/${agent_username}/reprepro-updater/scripts/setup_repo.py ubuntu_testing -q", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in line 216, it should be:
unless => "/home/${agent_username}/reprepro-updater/scripts/setup_repo.py ubuntu_main -q",
Note ubuntu_main vs ubuntu_testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch!
The changes in the branch did not fix the problem in my case. Sorry that I do not really know puppet, so I am not sure how to debug. I tried this naive approach:
And that generated this output:
So PYTHONPATH looks just fine, I am not sure why the error still happens. |
Seeing the comment by @jonazpiazu I haven't tested this yet @nuclearsandwich. I do seem to remember that after |
Thanks for the feedback @jonazpiazu and @gavanderhoorn. I tore down and started on a fresh machine and it fails the first time but succeeds the second. I learned from @tfoote that puppet sometimes needs to be run twice (and observed this previously when provisioning master) but I don't remember it being necessary for repo hosts. I think the change here is still warranted as there's not much use in having a literal I'm going to dig through puppet to see if something is finishing the setup of python and should be required before the repository initializations. |
While investigating #174 some typos were found in the repository initialization logic that were best resolved by a little puppet refactoring. Additionally, the exec and unless commands are now run with `python` rather than invoking the script directly as $0. To be honest, I do not know how these commands were executing without a crunchbang line. It's possible that this just hasn't worked as expected for some time. The decision to use python rather than python3 was made by examining how reprepro-updater is invoked by ros_buildfarm jobs.
I'm by no means a puppet expert, but in my experience most problems are due to missing dependency declarations (or whatever puppet calls those). That is probably also the cause of #171 (I worked around that in #70 (comment)). Running puppet twice is at best a work-around. It would be nice if we could deploy master, agent(s) and slave successfully, without needing that.
Exactly. I wasn't expecting this either. |
Yep, I'm digging in to figure out what the missing link in the chain is here. Thanks for the input and patience. |
I was under the impression that this module was builtin but I guess I was wrong.
Adding the repo_files variable to the previous File resource list was not sufficient.
Okay, I think the latest changes should do it. I'm building new test branches and deploying to a new host to be sure. |
Before you do that you might want to remove the |
Good catch. Because the |
This is redundant at the moment as Python is required by profile::jenkins::agent. If the relationship between these classes ever changes this may need to be re-added.
Just ran a This is just a test VM, so the Nice one @nuclearsandwich 👍. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work. LGTM.
I'm sorry to say that these fixes don't seem to work here. I have tried it several times by going back to a fresh imagen and executing
I tried this by setting |
@inigomartinez: I'm not sure, but I believe this PR targets the |
This is correct. There are outstanding issues with master deployments (though if you run |
Puppet, at least version 3.8.5, does not evaluate environment variable strings for variable expansion, which was leading to a PYTHONPATH variable of
/home/jenkins-agent/reprepro-updater/src:$PYTHONPATH
with a literal$PYTHONPATH
.This interfered with the default path and caused #174
I made a test deployment with this patch (and a few others). @gavanderhoorn if you have time to verify that this addresses #174 for you it would be appreciated.