Skip to content

Fix bootstrapping from Git on CentOS7 when systemd is not running#915

Merged
rallytime merged 1 commit intosaltstack:developfrom
vutny:fix-centos7-git-container-build
Jul 18, 2016
Merged

Fix bootstrapping from Git on CentOS7 when systemd is not running#915
rallytime merged 1 commit intosaltstack:developfrom
vutny:fix-centos7-git-container-build

Conversation

@vutny
Copy link
Copy Markdown
Contributor

@vutny vutny commented Jul 18, 2016

What does this PR do?

If you'd like to build a CentOS 7 container/VM image containing Salt using docker build or Packer etc with bootstrap-salt.sh, it will fail to perform git installation type.

The main problem is in install_centos_git_post() function which executes /bin/systemctl daemon-reload at the very end. As a result, if systemd is not running (because we're building an image and there is no init system running on target), later logic in the script detects the return code not equal to 0 and aborts execution.

By this PR the post install functions will always return 0. Also, I've made some optimizations to execute /bin/systemctl only when it is necessary.

Previous Behavior

Git installation type fails when building OS images:

 *  INFO: Running install_centos_git_post()
 * DEBUG: The passed destination(/usr/lib/systemd/system/) is a directory
 * DEBUG: Full destination path is now: /usr/lib/systemd/system//salt-minion.service
 * DEBUG: Copying /tmp/git/salt/pkg/rpm/salt-minion.service to /usr/lib/systemd/system//salt-minion.service
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /usr/lib/systemd/system/salt-minion.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-master.service to /usr/lib/systemd/system/salt-master.service.
 * DEBUG: The passed destination(/usr/lib/systemd/system/) is a directory
 * DEBUG: Full destination path is now: /usr/lib/systemd/system//salt-api.service
 * DEBUG: Copying /tmp/git/salt/pkg/rpm/salt-api.service to /usr/lib/systemd/system//salt-api.service
Failed to get D-Bus connection: Operation not permitted
 * ERROR: Failed to run install_centos_git_post()!!!
 * DEBUG: Cleaning up the Salt Temporary Git Repository
 * DEBUG: Removing the logging pipe /tmp/bootstrap-salt.logpipe
 * DEBUG: Killing logging pipe tee's with pid(s): 35

New Behavior

Git installation type succeeds.

e.g. during the build process of container/VM images
@rallytime rallytime merged commit 8b4f2dc into saltstack:develop Jul 18, 2016
@vutny vutny deleted the fix-centos7-git-container-build branch July 18, 2016 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants