Skip to content
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

Fixes #15141: Make ncf-setup supports ncf install from local ncf #496

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 15 additions & 27 deletions scripts/rudder-setup/setup-ncf.sh
Expand Up @@ -17,27 +17,8 @@ get_cfengine_url() {

setup_ncf() {

# Install dependencies
${PM_UPDATE}
if [ ${OS_NAME} = "CentOS" ];
then
${PM_INSTALL} curl libcurl nss
${PM_UPGRADE} curl libcurl nss
fi

${PM_INSTALL} git || ${PM_INSTALL} git-core
${PM_INSTALL} make curl

if [ $TESTINFRA -eq 1 ];
then
# install pip
${PM_INSTALL} python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install -U six || /bin/true
pip install -U testinfra --ignore-installed six
fi

# install dependencies
install_test_dependencies

# setup cfengine

Expand All @@ -59,7 +40,6 @@ setup_ncf() {
fi

# setup ncf

if echo "${NCF_VERSION}" | grep "^[0-9.\\-]*$" > /dev/null
then
# TODO ncf package from repo
Expand All @@ -78,12 +58,20 @@ setup_ncf() {
${PM_INSTALL} ncf
remove_repo
else
## ncf from git
git_url=$(echo "${NCF_VERSION}" | cut -f 1 -d "#")
git_branch=$(echo "${NCF_VERSION}" | cut -f 2 -d "#")
[ -z "${git_branch}" ] && git_branch=master
directory=$(mktemp -d)
git clone -q -b "${git_branch}" "${git_url}" "${directory}"

## NCF from local source
if [ -d "${NCF_VERSION}" ]
then
echo "Installing ncf from local source: ${NCF_SOURCE}"
cp -r ${NCF_VERSION}/* ${directory}
## NCF from git
else
git_url=$(echo "${NCF_VERSION}" | cut -f 1 -d "#")
git_branch=$(echo "${NCF_VERSION}" | cut -f 2 -d "#")
[ -z "${git_branch}" ] && git_branch=master
git clone -q -b "${git_branch}" "${git_url}" "${directory}"
fi

cd "${directory}"
# avoid making doc
Expand Down
38 changes: 30 additions & 8 deletions scripts/rudder-setup/test-ncf.sh
@@ -1,8 +1,27 @@
TEST_DEPENDENCIES="curl lsb-release htop python-jinja2 git ntp acl"
SLES_DEPENDENCIES="curl lsb-release dos2unix git-core createrepo createrepo_c acl"

test_ncf() {
cd "${directory}"
# Use path from Rudder package if present
export PATH="${PATH}:/var/rudder/cfengine-community/bin/"

# Start the test suite
echo "Beginning tests, using CFEngine version \"`cf-agent -V`\""
make "${TEST_TARGET}"
}

install_test_dependencies() {
TEST_DEPENDENCIES="htop python-jinja2 ntp acl"
SLES_DEPENDENCIES="dos2unix createrepo createrepo_c acl"
# Install dependencies
${PM_UPDATE}
if [ ${OS_NAME} = "CentOS" ];
then
${PM_INSTALL} curl libcurl nss
${PM_UPGRADE} curl libcurl nss
fi

${PM_INSTALL} git || ${PM_INSTALL} git-core
${PM_INSTALL} make curl lsb-release

# Install dependencies
${PM_UPDATE}
Expand All @@ -14,10 +33,13 @@ test_ncf() {
${PM_INSTALL} ${TEST_DEPENDENCIES}
fi

# Use path from Rudder package if present
export PATH="${PATH}:/var/rudder/cfengine-community/bin/"

# Start the test suite
echo "Beginning tests, using CFEngine version \"`cf-agent -V`\""
make "${TEST_TARGET}"
if [ $TESTINFRA -eq 1 ];
then
# install pip
${PM_INSTALL} python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py || /bin/true
python get-pip.py || /bin/true
pip install -U six || /bin/true
pip install -U testinfra --ignore-installed six || /bin/true
fi
}