diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-09-15 20:13:07 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-09-15 20:13:07 -0400 |
commit | bea35b7685978804557aada44c819c536ab209b3 (patch) | |
tree | 070fb6db5efec8e0cd2e5d1d51d4c7f5e748085e /tools | |
parent | 668919511625f7b6a8922e4504e224e915f7be22 (diff) | |
parent | 6093b8b2733814b9265494c47f4268167c9491ab (diff) | |
download | vyos-cloud-init-bea35b7685978804557aada44c819c536ab209b3.tar.gz vyos-cloud-init-bea35b7685978804557aada44c819c536ab209b3.zip |
merge from trunk
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/build-on-freebsd | 58 | ||||
-rwxr-xr-x | tools/hacking.py | 4 | ||||
-rwxr-xr-x | tools/mock-meta.py | 8 | ||||
-rwxr-xr-x | tools/run-pep8 | 2 | ||||
-rwxr-xr-x | tools/run-pylint | 26 |
5 files changed, 65 insertions, 33 deletions
diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd new file mode 100755 index 00000000..65d783f7 --- /dev/null +++ b/tools/build-on-freebsd @@ -0,0 +1,58 @@ +#!/bin/sh +# Since there is no official FreeBSD port yet, we need some way of building and +# installing cloud-init. This script takes care of building and installing. It +# will optionally make a first run at the end. + +fail() { echo "FAILED:" "$@" 1>&2; exit 1; } + +# Check dependencies: +depschecked=/tmp/c-i.dependencieschecked +pkgs=" + dmidecode + py27-argparse + py27-boto gpart sudo + py27-configobj py27-yaml + py27-Jinja2 + py27-oauth py27-serial + py27-prettytable + py27-requests py27-six + python py27-cheetah + py27-jsonpointer py27-jsonpatch +" +[ -f "$depschecked" ] || pkg install ${pkgs} || fail "install packages" +touch $depschecked + +# Required but unavailable port/pkg: py27-jsonpatch py27-jsonpointer +# Luckily, the install step will take care of this by installing it from pypi... + +# Build the code and install in /usr/local/: +python setup.py build +python setup.py install -O1 --skip-build --prefix /usr/local/ --init-system sysvinit_freebsd + +# Install the correct config file: +cp config/cloud.cfg-freebsd /usr/local/etc/cloud/cloud.cfg + +# Enable cloud-init in /etc/rc.conf: +sed -i.bak -e "/cloudinit_enable=.*/d" /etc/rc.conf +echo 'cloudinit_enable="YES"' >> /etc/rc.conf + +echo "Installation completed." + +if [ "$1" = "run" ]; then + echo "Ok, now let's see if it works." + + # Backup SSH keys + mv /etc/ssh/ssh_host_* /tmp/ + + # Remove old metadata + rm -rf /var/lib/cloud + + # Just log everything, quick&dirty + rm /usr/local/etc/cloud/cloud.cfg.d/05_logging.cfg + + # Start: + /usr/local/etc/rc.d/cloudinit start + + # Restore SSH keys + mv /tmp/ssh_host_* /etc/ssh/ +fi diff --git a/tools/hacking.py b/tools/hacking.py index 14bd0cda..e7797564 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -154,7 +154,7 @@ def add_cloud(): if not inspect.isfunction(function): continue if name.startswith("cloud_"): - exec("pep8.%s = %s" % (name, name)) # pylint: disable=W0122 + exec("pep8.%s = %s" % (name, name)) if __name__ == "__main__": # NOVA based 'hacking.py' error codes start with an N @@ -163,7 +163,7 @@ if __name__ == "__main__": pep8.current_file = current_file pep8.readlines = readlines try: - pep8._main() # pylint: disable=W0212 + pep8._main() finally: if len(_missingImport) > 0: print >> sys.stderr, ("%i imports missing in this test environment" diff --git a/tools/mock-meta.py b/tools/mock-meta.py index c79f0598..dfbc2a71 100755 --- a/tools/mock-meta.py +++ b/tools/mock-meta.py @@ -23,7 +23,7 @@ import json import logging import os import random -import string # pylint: disable=W0402 +import string import sys import yaml @@ -306,7 +306,7 @@ class UserDataHandler(object): blob = "\n".join(lines) return blob.strip() - def get_data(self, params, who, **kwargs): # pylint: disable=W0613 + def get_data(self, params, who, **kwargs): if not params: return self._get_user_blob(who=who) return NOT_IMPL_RESPONSE @@ -427,8 +427,8 @@ def extract_opts(): def setup_fetchers(opts): - global meta_fetcher # pylint: disable=W0603 - global user_fetcher # pylint: disable=W0603 + global meta_fetcher + global user_fetcher meta_fetcher = MetaDataHandler(opts) user_fetcher = UserDataHandler(opts) diff --git a/tools/run-pep8 b/tools/run-pep8 index cfce5edd..d0a131f6 100755 --- a/tools/run-pep8 +++ b/tools/run-pep8 @@ -13,7 +13,7 @@ else base=`pwd`/tools/ fi -IGNORE="E501" # Line too long (these are caught by pylint) +IGNORE="" # King Arthur: Be quiet! ... Be Quiet! I Order You to Be Quiet. IGNORE="$IGNORE,E121" # Continuation line indentation is not a multiple of four diff --git a/tools/run-pylint b/tools/run-pylint deleted file mode 100755 index 0fe0c64a..00000000 --- a/tools/run-pylint +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -if [ $# -eq 0 ]; then - files=( bin/cloud-init $(find * -name "*.py" -type f) ) -else - files=( "$@" ); -fi - -RC_FILE="pylintrc" -if [ ! -f $RC_FILE ]; then - RC_FILE="../pylintrc" -fi - -cmd=( - pylint - --rcfile=$RC_FILE - --disable=R - --disable=I - --dummy-variables-rgx="_" - "${files[@]}" -) - -echo -e "\nRunning pylint:" -echo "${cmd[@]}" -"${cmd[@]}" - |