From d2d12dda2ddd576504adc32f71944eab72d6481a Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 9 Aug 2014 10:27:28 +0000 Subject: new: Buildscript for installing on FreeBSD. This should do until a proper port is created. --- tools/build-on-freebsd | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 tools/build-on-freebsd (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd new file mode 100755 index 00000000..03cba7fc --- /dev/null +++ b/tools/build-on-freebsd @@ -0,0 +1,40 @@ +#!/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. + +# Check dependencies: +[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six +touch /tmp/c-i.dependencieschecked + +# Required but unavailable port/pkg: py27-jsonpatch +# 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 + +# Move the configdir to /usr/local/ and use freebsd.cfg: +[ -d /usr/local/etc/cloud ] && rm -rf /usr/local/etc/cloud +mv /etc/cloud /usr/local/etc/ +mv /usr/local/etc/cloud/cloud.freebsd.cfg /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." + + # 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 +fi -- cgit v1.2.3 From aff5c13ac9e3723e99d7414ac82f30c853f453fd Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 9 Aug 2014 10:56:13 +0000 Subject: fix: More dependencies. --- tools/build-on-freebsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 03cba7fc..52bceb21 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -4,7 +4,7 @@ # will optionally make a first run at the end. # Check dependencies: -[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six +[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo touch /tmp/c-i.dependencieschecked # Required but unavailable port/pkg: py27-jsonpatch -- cgit v1.2.3 From 5d96928ee2a2573aaf49727adafc91120daa1d36 Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 9 Aug 2014 10:57:28 +0000 Subject: new: Some datasources (like Smartos) use dmidecode to gather some specific information, so install it. --- tools/build-on-freebsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 52bceb21..ff59bd25 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -4,7 +4,7 @@ # will optionally make a first run at the end. # Check dependencies: -[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo +[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode touch /tmp/c-i.dependencieschecked # Required but unavailable port/pkg: py27-jsonpatch -- cgit v1.2.3 From f1202c1b0aeae7378589215887c74f325e6c77cd Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 9 Aug 2014 21:24:19 +0000 Subject: change: Create a symlink to python2.7, to make sure running plain python works. --- tools/build-on-freebsd | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index ff59bd25..0a545207 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -3,6 +3,9 @@ # installing cloud-init. This script takes care of building and installing. It # will optionally make a first run at the end. +# Since there is no python by default, create a symlink for convenience sake: +ln -sf /usr/local/bin/python2.7 /usr/local/bin/python + # Check dependencies: [ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode touch /tmp/c-i.dependencieschecked -- cgit v1.2.3 From 7e0407491345989a2640149a9a365b6f7167c7af Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 9 Aug 2014 21:25:54 +0000 Subject: change: Make note of another python lib pypi takes care of. --- tools/build-on-freebsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 0a545207..da33e4b0 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -10,7 +10,7 @@ ln -sf /usr/local/bin/python2.7 /usr/local/bin/python [ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode touch /tmp/c-i.dependencieschecked -# Required but unavailable port/pkg: py27-jsonpatch +# 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/: -- cgit v1.2.3 From 891496973520c91fd02ccfc55aa606234418accb Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sun, 10 Aug 2014 09:41:42 +0000 Subject: change: Save and restore the SSH keys between builds. --- tools/build-on-freebsd | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index da33e4b0..7d19f44c 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -32,6 +32,9 @@ 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 @@ -40,4 +43,7 @@ then # Start: /usr/local/etc/rc.d/cloudinit start + + # Restore SSH keys + mv /tmp/ssh_host_* /etc/ssh/ fi -- cgit v1.2.3 From 833ebcba6ca333183284d1f9a0fe5f53df802712 Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sun, 10 Aug 2014 11:50:19 +0000 Subject: change: Install everything in the right location on both Linux (which ofcourse already was good) and FreeBSD (which realy likes /usr/local for this). --- setup.py | 51 ++++++++++++++++++++++++++++++++++++-------------- tools/build-on-freebsd | 4 +--- 2 files changed, 38 insertions(+), 17 deletions(-) (limited to 'tools') diff --git a/setup.py b/setup.py index 7b061824..b09c0456 100755 --- a/setup.py +++ b/setup.py @@ -90,6 +90,42 @@ def read_requires(): return str(deps).splitlines() +# Install everything in the right location and take care of Linux (default) and +# FreeBSD systems. +def read_datafiles(): + sysname = os.uname()[0] + if sysname == 'FreeBSD': + return [ + ('/usr/local/etc/cloud', glob('config/*.cfg')), + ('/usr/local/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), + ('/usr/local/etc/cloud/templates', glob('templates/*')), + ('/usr/local/share/cloud-init', []), + ('/usr/local/lib/cloud-init', + ['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']), + ('/usr/local/share/doc/cloud-init', + [f for f in glob('doc/*') if is_f(f)]), + ('/usr/local/share/doc/cloud-init/examples', + [f for f in glob('doc/examples/*') if is_f(f)]), + ('/usr/local/share/doc/cloud-init/examples/seed', + [f for f in glob('doc/examples/seed/*') if is_f(f)]), + ] + else: + return [ + ('/etc/cloud', glob('config/*.cfg')), + ('/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), + ('/etc/cloud/templates', glob('templates/*')), + ('/usr/share/cloud-init', []), + ('/usr/lib/cloud-init', + ['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']), + ('/usr/share/doc/cloud-init', + [f for f in glob('doc/*') if is_f(f)]), + ('/usr/share/doc/cloud-init/examples', + [f for f in glob('doc/examples/*') if is_f(f)]), + ('/usr/share/doc/cloud-init/examples/seed', + [f for f in glob('doc/examples/seed/*') if is_f(f)]), + ] + + # TODO: Is there a better way to do this?? class InitsysInstallData(install): init_system = None @@ -138,20 +174,7 @@ setuptools.setup(name='cloud-init', 'tools/cloud-init-per', ], license='GPLv3', - data_files=[('/etc/cloud', glob('config/*.cfg')), - ('/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), - ('/etc/cloud/templates', glob('templates/*')), - ('/usr/share/cloud-init', []), - ('/usr/lib/cloud-init', - ['tools/uncloud-init', - 'tools/write-ssh-key-fingerprints']), - ('/usr/share/doc/cloud-init', - [f for f in glob('doc/*') if is_f(f)]), - ('/usr/share/doc/cloud-init/examples', - [f for f in glob('doc/examples/*') if is_f(f)]), - ('/usr/share/doc/cloud-init/examples/seed', - [f for f in glob('doc/examples/seed/*') if is_f(f)]), - ], + data_files=read_datafiles(), install_requires=read_requires(), cmdclass={ # Use a subclass for install that handles diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 7d19f44c..6e6ce8b6 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -17,9 +17,7 @@ touch /tmp/c-i.dependencieschecked python setup.py build python setup.py install -O1 --skip-build --prefix /usr/local/ --init-system sysvinit_freebsd -# Move the configdir to /usr/local/ and use freebsd.cfg: -[ -d /usr/local/etc/cloud ] && rm -rf /usr/local/etc/cloud -mv /etc/cloud /usr/local/etc/ +# Use the correct config file: mv /usr/local/etc/cloud/cloud.freebsd.cfg /usr/local/etc/cloud/cloud.cfg # Enable cloud-init in /etc/rc.conf: -- cgit v1.2.3 From 57b5f63467dcc74b0b39a14b5baeb1974cdc3373 Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Thu, 14 Aug 2014 16:18:15 +0000 Subject: fix: Install the python package that will install the required link to the python2.7 binary. This defaults to 2.7, which is fine. --- tools/build-on-freebsd | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 6e6ce8b6..6a3f38ec 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -3,11 +3,8 @@ # installing cloud-init. This script takes care of building and installing. It # will optionally make a first run at the end. -# Since there is no python by default, create a symlink for convenience sake: -ln -sf /usr/local/bin/python2.7 /usr/local/bin/python - # Check dependencies: -[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode +[ ! -f /tmp/c-i.dependencieschecked ] && pkg install python py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode touch /tmp/c-i.dependencieschecked # Required but unavailable port/pkg: py27-jsonpatch py27-jsonpointer -- cgit v1.2.3 From 9d8628772131bbe127bfefd6337cda34025723c8 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 22 Aug 2014 16:50:47 -0400 Subject: build-on-freebsd: minor cleanups/bikeshedding --- tools/build-on-freebsd | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 6a3f38ec..66b95d68 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -3,8 +3,22 @@ # 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: -[ ! -f /tmp/c-i.dependencieschecked ] && pkg install python py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode +depscheck=/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 +" +[ -f "$depschecked" ] || pkg install ${pkgs} || fail "install packages" touch /tmp/c-i.dependencieschecked # Required but unavailable port/pkg: py27-jsonpatch py27-jsonpointer @@ -23,8 +37,7 @@ echo 'cloudinit_enable="YES"' >> /etc/rc.conf echo "Installation completed." -if [ "$1" = "run" ] -then +if [ "$1" = "run" ]; then echo "Ok, now let's see if it works." # Backup SSH keys -- cgit v1.2.3 From c728de2115aacbe0f48d65661c076caace5e16e7 Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 23 Aug 2014 12:06:51 +0000 Subject: fix: Use the correct variable. --- tools/build-on-freebsd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 66b95d68..b0203cb8 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -6,7 +6,7 @@ fail() { echo "FAILED:" "$@" 1>&2; exit 1; } # Check dependencies: -depscheck=/tmp/c-i.dependencieschecked +depschecked=/tmp/c-i.dependencieschecked pkgs=" dmidecode py27-argparse @@ -19,7 +19,7 @@ pkgs=" python py27-cheetah " [ -f "$depschecked" ] || pkg install ${pkgs} || fail "install packages" -touch /tmp/c-i.dependencieschecked +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... -- cgit v1.2.3 From 9fcb3f2c7c129576f9a2175614bcb384d492f63e Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Sat, 23 Aug 2014 12:16:03 +0000 Subject: change: Rename the config file to cloud.cfg-freebsd so it doesn't get copied per default. Packaging will take care of installing this configfile on the BSD platform. --- config/cloud.cfg-freebsd | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ config/cloud.freebsd.cfg | 88 ------------------------------------------------ tools/build-on-freebsd | 4 +-- 3 files changed, 90 insertions(+), 90 deletions(-) create mode 100644 config/cloud.cfg-freebsd delete mode 100644 config/cloud.freebsd.cfg (limited to 'tools') diff --git a/config/cloud.cfg-freebsd b/config/cloud.cfg-freebsd new file mode 100644 index 00000000..bb3a4a51 --- /dev/null +++ b/config/cloud.cfg-freebsd @@ -0,0 +1,88 @@ +# The top level settings are used as module +# and system configuration. + +syslog_fix_perms: root:wheel + +# This should not be required, but leave it in place until the real cause of +# not beeing able to find -any- datasources is resolved. +datasource_list: ['OpenStack'] + +# A set of users which may be applied and/or used by various modules +# when a 'default' entry is found it will reference the 'default_user' +# from the distro configuration specified below +users: + - default + +# If this is set, 'root' will not be able to ssh in and they +# will get a message to login instead as the above $user (ubuntu) +disable_root: false + +# This will cause the set+update hostname module to not operate (if true) +preserve_hostname: false + +# Example datasource config +# datasource: +# Ec2: +# metadata_urls: [ 'blah.com' ] +# timeout: 5 # (defaults to 50 seconds) +# max_wait: 10 # (defaults to 120 seconds) + +# The modules that run in the 'init' stage +cloud_init_modules: +# - migrator + - seed_random + - bootcmd +# - write-files + - growpart + - resizefs + - set_hostname + - update_hostname +# - update_etc_hosts +# - ca-certs +# - rsyslog + - users-groups + - ssh + +# The modules that run in the 'config' stage +cloud_config_modules: +# - disk_setup +# - mounts + - ssh-import-id + - locale +# - set-passwords +# - package-update-upgrade-install +# - landscape +# - timezone +# - puppet +# - chef +# - salt-minion +# - mcollective + - disable-ec2-metadata + - runcmd +# - byobu + +# The modules that run in the 'final' stage +cloud_final_modules: + - rightscale_userdata + - scripts-vendor + - scripts-per-once + - scripts-per-boot + - scripts-per-instance + - scripts-user + - ssh-authkey-fingerprints + - keys-to-console + - phone-home + - final-message + - power-state-change + +# System and/or distro specific settings +# (not accessible to handlers/transforms) +system_info: + distro: freebsd + default_user: + name: beastie + lock_passwd: True + gecos: FreeBSD + groups: [wheel] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /bin/sh diff --git a/config/cloud.freebsd.cfg b/config/cloud.freebsd.cfg deleted file mode 100644 index bb3a4a51..00000000 --- a/config/cloud.freebsd.cfg +++ /dev/null @@ -1,88 +0,0 @@ -# The top level settings are used as module -# and system configuration. - -syslog_fix_perms: root:wheel - -# This should not be required, but leave it in place until the real cause of -# not beeing able to find -any- datasources is resolved. -datasource_list: ['OpenStack'] - -# A set of users which may be applied and/or used by various modules -# when a 'default' entry is found it will reference the 'default_user' -# from the distro configuration specified below -users: - - default - -# If this is set, 'root' will not be able to ssh in and they -# will get a message to login instead as the above $user (ubuntu) -disable_root: false - -# This will cause the set+update hostname module to not operate (if true) -preserve_hostname: false - -# Example datasource config -# datasource: -# Ec2: -# metadata_urls: [ 'blah.com' ] -# timeout: 5 # (defaults to 50 seconds) -# max_wait: 10 # (defaults to 120 seconds) - -# The modules that run in the 'init' stage -cloud_init_modules: -# - migrator - - seed_random - - bootcmd -# - write-files - - growpart - - resizefs - - set_hostname - - update_hostname -# - update_etc_hosts -# - ca-certs -# - rsyslog - - users-groups - - ssh - -# The modules that run in the 'config' stage -cloud_config_modules: -# - disk_setup -# - mounts - - ssh-import-id - - locale -# - set-passwords -# - package-update-upgrade-install -# - landscape -# - timezone -# - puppet -# - chef -# - salt-minion -# - mcollective - - disable-ec2-metadata - - runcmd -# - byobu - -# The modules that run in the 'final' stage -cloud_final_modules: - - rightscale_userdata - - scripts-vendor - - scripts-per-once - - scripts-per-boot - - scripts-per-instance - - scripts-user - - ssh-authkey-fingerprints - - keys-to-console - - phone-home - - final-message - - power-state-change - -# System and/or distro specific settings -# (not accessible to handlers/transforms) -system_info: - distro: freebsd - default_user: - name: beastie - lock_passwd: True - gecos: FreeBSD - groups: [wheel] - sudo: ["ALL=(ALL) NOPASSWD:ALL"] - shell: /bin/sh diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index b0203cb8..23bdf487 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -28,8 +28,8 @@ touch $depschecked python setup.py build python setup.py install -O1 --skip-build --prefix /usr/local/ --init-system sysvinit_freebsd -# Use the correct config file: -mv /usr/local/etc/cloud/cloud.freebsd.cfg /usr/local/etc/cloud/cloud.cfg +# 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 -- cgit v1.2.3 From 5fb6482692cfffba5ba45102858b14ba3acc5bc7 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 26 Aug 2014 15:53:41 -0400 Subject: further remove evidence of pylint. This just removes comments '# pylint:' things and other code remnents of pylint. --- Makefile | 2 +- cloudinit/config/cc_disk_setup.py | 2 +- cloudinit/config/cc_mounts.py | 2 +- cloudinit/config/cc_power_state_change.py | 4 ++-- cloudinit/config/cc_resizefs.py | 8 +++---- cloudinit/config/cc_set_passwords.py | 2 +- cloudinit/distros/parsers/resolv_conf.py | 4 ++-- cloudinit/handlers/boot_hook.py | 3 +-- cloudinit/handlers/cloud_config.py | 3 +-- cloudinit/handlers/shell_script.py | 3 +-- cloudinit/handlers/upstart_job.py | 3 +-- cloudinit/patcher.py | 2 +- cloudinit/sources/DataSourceOpenNebula.py | 2 +- cloudinit/type_utils.py | 2 -- cloudinit/url_helper.py | 13 +++++------ cloudinit/util.py | 16 ++++++------- packages/debian/control.in | 1 - pylintrc | 19 ---------------- setup.py | 2 +- tests/unittests/test__init__.py | 3 +-- tests/unittests/test_distros/test_generic.py | 4 ++-- .../test_handler/test_handler_growpart.py | 2 -- tests/unittests/test_merging.py | 2 +- tests/unittests/test_util.py | 6 ++--- tools/hacking.py | 4 ++-- tools/mock-meta.py | 8 +++---- tools/run-pep8 | 2 +- tools/run-pylint | 26 ---------------------- 28 files changed, 45 insertions(+), 105 deletions(-) delete mode 100644 pylintrc delete mode 100755 tools/run-pylint (limited to 'tools') diff --git a/Makefile b/Makefile index d96e6488..009257ca 100644 --- a/Makefile +++ b/Makefile @@ -58,5 +58,5 @@ rpm: deb: ./packages/bddeb -.PHONY: test pylint pyflakes 2to3 clean pep8 rpm deb yaml check_version +.PHONY: test pyflakes 2to3 clean pep8 rpm deb yaml check_version .PHONY: pip-test-requirements pip-requirements clean_pyc diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py index a5209268..1660832b 100644 --- a/cloudinit/config/cc_disk_setup.py +++ b/cloudinit/config/cc_disk_setup.py @@ -484,7 +484,7 @@ def get_partition_mbr_layout(size, layout): def purge_disk_ptable(device): # wipe the first and last megabyte of a disk (or file) # gpt stores partition table both at front and at end. - null = '\0' # pylint: disable=W1401 + null = '\0' start_len = 1024 * 1024 end_len = 1024 * 1024 with open(device, "rb+") as fp: diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py index 80590118..ba1303d1 100644 --- a/cloudinit/config/cc_mounts.py +++ b/cloudinit/config/cc_mounts.py @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from string import whitespace # pylint: disable=W0402 +from string import whitespace import logging import os.path diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index 638daef8..09d37371 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -119,7 +119,7 @@ def load_power_state(cfg): def doexit(sysexit): - os._exit(sysexit) # pylint: disable=W0212 + os._exit(sysexit) def execmd(exe_args, output=None, data_in=None): @@ -127,7 +127,7 @@ def execmd(exe_args, output=None, data_in=None): proc = subprocess.Popen(exe_args, stdin=subprocess.PIPE, stdout=output, stderr=subprocess.STDOUT) proc.communicate(data_in) - ret = proc.returncode # pylint: disable=E1101 + ret = proc.returncode except Exception: doexit(EXIT_FAIL) doexit(ret) diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index 667d5977..b9655749 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -28,19 +28,19 @@ from cloudinit import util frequency = PER_ALWAYS -def _resize_btrfs(mount_point, devpth): # pylint: disable=W0613 +def _resize_btrfs(mount_point, devpth): return ('btrfs', 'filesystem', 'resize', 'max', mount_point) -def _resize_ext(mount_point, devpth): # pylint: disable=W0613 +def _resize_ext(mount_point, devpth): return ('resize2fs', devpth) -def _resize_xfs(mount_point, devpth): # pylint: disable=W0613 +def _resize_xfs(mount_point, devpth): return ('xfs_growfs', devpth) -def _resize_ufs(mount_point, devpth): # pylint: disable=W0613 +def _resize_ufs(mount_point, devpth): return ('growfs', devpth) # Do not use a dictionary as these commands should be able to be used diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index 4a3b21af..24e33915 100644 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -28,7 +28,7 @@ from cloudinit import distros as ds from cloudinit import ssh_util from cloudinit import util -from string import letters, digits # pylint: disable=W0402 +from string import letters, digits # We are removing certain 'painful' letters/numbers PW_SET = (letters.translate(None, 'loLOI') + diff --git a/cloudinit/distros/parsers/resolv_conf.py b/cloudinit/distros/parsers/resolv_conf.py index 1be9d46b..5733c25a 100644 --- a/cloudinit/distros/parsers/resolv_conf.py +++ b/cloudinit/distros/parsers/resolv_conf.py @@ -137,8 +137,8 @@ class ResolvConf(object): self._contents.append(('option', ['search', s_list, ''])) return flat_sds - @local_domain.setter # pl51222 pylint: disable=E1101 - def local_domain(self, domain): # pl51222 pylint: disable=E0102 + @local_domain.setter + def local_domain(self, domain): self.parse() self._remove_option('domain') self._contents.append(('option', ['domain', str(domain), ''])) diff --git a/cloudinit/handlers/boot_hook.py b/cloudinit/handlers/boot_hook.py index 1848ce2c..3a50cf87 100644 --- a/cloudinit/handlers/boot_hook.py +++ b/cloudinit/handlers/boot_hook.py @@ -53,8 +53,7 @@ class BootHookPartHandler(handlers.Handler): util.write_file(filepath, contents.lstrip(), 0700) return filepath - def handle_part(self, _data, ctype, filename, # pylint: disable=W0221 - payload, frequency): # pylint: disable=W0613 + def handle_part(self, data, ctype, filename, payload, frequency): if ctype in handlers.CONTENT_SIGNALS: return diff --git a/cloudinit/handlers/cloud_config.py b/cloudinit/handlers/cloud_config.py index 4232700f..bf994e33 100644 --- a/cloudinit/handlers/cloud_config.py +++ b/cloudinit/handlers/cloud_config.py @@ -138,8 +138,7 @@ class CloudConfigPartHandler(handlers.Handler): self.file_names = [] self.cloud_buf = None - def handle_part(self, _data, ctype, filename, # pylint: disable=W0221 - payload, _frequency, headers): # pylint: disable=W0613 + def handle_part(self, data, ctype, filename, payload, frequency, headers): if ctype == handlers.CONTENT_START: self._reset() return diff --git a/cloudinit/handlers/shell_script.py b/cloudinit/handlers/shell_script.py index 30c1ed89..9755ab05 100644 --- a/cloudinit/handlers/shell_script.py +++ b/cloudinit/handlers/shell_script.py @@ -44,8 +44,7 @@ class ShellScriptPartHandler(handlers.Handler): handlers.type_from_starts_with(SHELL_PREFIX), ] - def handle_part(self, _data, ctype, filename, # pylint: disable=W0221 - payload, frequency): # pylint: disable=W0613 + def handle_part(self, data, ctype, filename, payload, frequency): if ctype in handlers.CONTENT_SIGNALS: # TODO(harlowja): maybe delete existing things here return diff --git a/cloudinit/handlers/upstart_job.py b/cloudinit/handlers/upstart_job.py index bac4cad2..50d193c4 100644 --- a/cloudinit/handlers/upstart_job.py +++ b/cloudinit/handlers/upstart_job.py @@ -44,8 +44,7 @@ class UpstartJobPartHandler(handlers.Handler): handlers.type_from_starts_with(UPSTART_PREFIX), ] - def handle_part(self, _data, ctype, filename, # pylint: disable=W0221 - payload, frequency): + def handle_part(self, data, ctype, filename, payload, frequency): if ctype in handlers.CONTENT_SIGNALS: return diff --git a/cloudinit/patcher.py b/cloudinit/patcher.py index 0f3c034e..f6609d6f 100644 --- a/cloudinit/patcher.py +++ b/cloudinit/patcher.py @@ -41,7 +41,7 @@ def _patch_logging(): fallback_handler = QuietStreamHandler(sys.stderr) fallback_handler.setFormatter(logging.Formatter(FALL_FORMAT)) - def handleError(self, record): # pylint: disable=W0613 + def handleError(self, record): try: fallback_handler.handle(record) fallback_handler.flush() diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py index 34557f8b..e2469f6e 100644 --- a/cloudinit/sources/DataSourceOpenNebula.py +++ b/cloudinit/sources/DataSourceOpenNebula.py @@ -28,7 +28,7 @@ import base64 import os import pwd import re -import string # pylint: disable=W0402 +import string from cloudinit import log as logging from cloudinit import sources diff --git a/cloudinit/type_utils.py b/cloudinit/type_utils.py index 2decbfc5..cc3d9495 100644 --- a/cloudinit/type_utils.py +++ b/cloudinit/type_utils.py @@ -19,8 +19,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# pylint: disable=C0302 import types diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py index 73c1fa4e..3074dd08 100644 --- a/cloudinit/url_helper.py +++ b/cloudinit/url_helper.py @@ -44,7 +44,7 @@ try: from distutils.version import LooseVersion import pkg_resources _REQ = pkg_resources.get_distribution('requests') - _REQ_VER = LooseVersion(_REQ.version) # pylint: disable=E1103 + _REQ_VER = LooseVersion(_REQ.version) if _REQ_VER >= LooseVersion('0.8.8'): SSL_ENABLED = True if _REQ_VER >= LooseVersion('0.7.0') and _REQ_VER < LooseVersion('1.0.0'): @@ -54,7 +54,7 @@ except: def _cleanurl(url): - parsed_url = list(urlparse(url, scheme='http')) # pylint: disable=E1123 + parsed_url = list(urlparse(url, scheme='http')) if not parsed_url[1] and parsed_url[2]: # Swap these since this seems to be a common # occurrence when given urls like 'www.google.com' @@ -90,7 +90,7 @@ class StringResponse(object): self.contents = contents self.url = None - def ok(self, *args, **kwargs): # pylint: disable=W0613 + def ok(self, *args, **kwargs): if self.code != 200: return False return True @@ -150,7 +150,7 @@ class UrlError(IOError): def _get_ssl_args(url, ssl_details): ssl_args = {} - scheme = urlparse(url).scheme # pylint: disable=E1101 + scheme = urlparse(url).scheme if scheme == 'https' and ssl_details: if not SSL_ENABLED: LOG.warn("SSL is not supported in requests v%s, " @@ -227,10 +227,9 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1, r = requests.request(**req_args) if check_status: - r.raise_for_status() # pylint: disable=E1103 + r.raise_for_status() LOG.debug("Read from %s (%s, %sb) after %s attempts", url, - r.status_code, len(r.content), # pylint: disable=E1103 - (i + 1)) + r.status_code, len(r.content), (i + 1)) # Doesn't seem like we can make it use a different # subclass for responses, so add our own backward-compat # attrs diff --git a/cloudinit/util.py b/cloudinit/util.py index 0821901a..bdb0f268 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -19,8 +19,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# pylint: disable=C0302 from StringIO import StringIO @@ -42,7 +40,7 @@ import re import shutil import socket import stat -import string # pylint: disable=W0402 +import string import subprocess import sys import tempfile @@ -198,11 +196,11 @@ def fork_cb(child_cb, *args): if fid == 0: try: child_cb(*args) - os._exit(0) # pylint: disable=W0212 + os._exit(0) except: logexc(LOG, "Failed forking and calling callback %s", type_utils.obj_name(child_cb)) - os._exit(1) # pylint: disable=W0212 + os._exit(1) else: LOG.debug("Forked child %s who will run callback %s", fid, type_utils.obj_name(child_cb)) @@ -487,7 +485,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None): new_fp = open(arg, owith) elif mode == "|": proc = subprocess.Popen(arg, shell=True, stdin=subprocess.PIPE) - new_fp = proc.stdin # pylint: disable=E1101 + new_fp = proc.stdin else: raise TypeError("Invalid type for output format: %s" % outfmt) @@ -509,7 +507,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None): new_fp = open(arg, owith) elif mode == "|": proc = subprocess.Popen(arg, shell=True, stdin=subprocess.PIPE) - new_fp = proc.stdin # pylint: disable=E1101 + new_fp = proc.stdin else: raise TypeError("Invalid type for error format: %s" % errfmt) @@ -937,7 +935,7 @@ def is_resolvable(name): should also not exist. The random entry will be resolved inside the search list. """ - global _DNS_REDIRECT_IP # pylint: disable=W0603 + global _DNS_REDIRECT_IP if _DNS_REDIRECT_IP is None: badips = set() badnames = ("does-not-exist.example.com.", "example.invalid.", @@ -1532,7 +1530,7 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False, (out, err) = sp.communicate(data) except OSError as e: raise ProcessExecutionError(cmd=args, reason=e) - rc = sp.returncode # pylint: disable=E1101 + rc = sp.returncode if rc not in rcs: raise ProcessExecutionError(stdout=out, stderr=err, exit_code=rc, diff --git a/packages/debian/control.in b/packages/debian/control.in index c892747c..9207e5f4 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -9,7 +9,6 @@ Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-nose, pyflakes, - pylint, python-setuptools, python-selinux, python-cheetah, diff --git a/pylintrc b/pylintrc deleted file mode 100644 index ee886510..00000000 --- a/pylintrc +++ /dev/null @@ -1,19 +0,0 @@ -[General] -init-hook='import sys; sys.path.append("tests/")' - -[MESSAGES CONTROL] -# See: http://pylint-messages.wikidot.com/all-codes -# W0142: *args and **kwargs are fine. -# W0511: TODOs in code comments are fine. -# W0702: No exception type(s) specified -# W0703: Catch "Exception" -# C0103: Invalid name -# C0111: Missing docstring -disable=W0142,W0511,W0702,W0703,C0103,C0111 - -[REPORTS] -reports=no -include-ids=yes - -[FORMAT] -max-line-length=79 diff --git a/setup.py b/setup.py index 556103b9..2fb191c0 100755 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def tiny_p(cmd, capture=True): sp = subprocess.Popen(cmd, stdout=stdout, stderr=stderr, stdin=None) (out, err) = sp.communicate() - ret = sp.returncode # pylint: disable=E1101 + ret = sp.returncode if ret not in [0]: raise RuntimeError("Failed running %s [rc=%s] (%s, %s)" % (cmd, ret, out, err)) diff --git a/tests/unittests/test__init__.py b/tests/unittests/test__init__.py index 03065c8b..17965488 100644 --- a/tests/unittests/test__init__.py +++ b/tests/unittests/test__init__.py @@ -18,8 +18,7 @@ class FakeModule(handlers.Handler): def list_types(self): return self.types - def handle_part(self, _data, ctype, filename, # pylint: disable=W0221 - payload, frequency): + def handle_part(self, data, ctype, filename, payload, frequency): pass diff --git a/tests/unittests/test_distros/test_generic.py b/tests/unittests/test_distros/test_generic.py index a972568f..db6aa0e8 100644 --- a/tests/unittests/test_distros/test_generic.py +++ b/tests/unittests/test_distros/test_generic.py @@ -26,8 +26,8 @@ package_mirrors = [ unknown_arch_info ] -gpmi = distros._get_package_mirror_info # pylint: disable=W0212 -gapmi = distros._get_arch_package_mirror_info # pylint: disable=W0212 +gpmi = distros._get_package_mirror_info +gapmi = distros._get_arch_package_mirror_info class TestGenericDistro(helpers.FilesystemMockingTestCase): diff --git a/tests/unittests/test_handler/test_handler_growpart.py b/tests/unittests/test_handler/test_handler_growpart.py index fa624197..5d0636d1 100644 --- a/tests/unittests/test_handler/test_handler_growpart.py +++ b/tests/unittests/test_handler/test_handler_growpart.py @@ -203,8 +203,6 @@ def simple_device_part_info(devpath): class Bunch(object): - st_mode = None # fix pylint complaint - def __init__(self, **kwds): self.__dict__.update(kwds) diff --git a/tests/unittests/test_merging.py b/tests/unittests/test_merging.py index 17704f8e..07b610f7 100644 --- a/tests/unittests/test_merging.py +++ b/tests/unittests/test_merging.py @@ -11,7 +11,7 @@ import glob import os import random import re -import string # pylint: disable=W0402 +import string SOURCE_PAT = "source*.*yaml" EXPECTED_PAT = "expected%s.yaml" diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 0cb41520..35e92445 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -1,5 +1,3 @@ -# pylint: disable=C0301 -# the mountinfo data lines are too long import os import stat import yaml @@ -18,7 +16,7 @@ class FakeSelinux(object): self.match_what = match_what self.restored = [] - def matchpathcon(self, path, mode): # pylint: disable=W0613 + def matchpathcon(self, path, mode): if path == self.match_what: return else: @@ -27,7 +25,7 @@ class FakeSelinux(object): def is_selinux_enabled(self): return True - def restorecon(self, path, recursive): # pylint: disable=W0613 + def restorecon(self, path, recursive): self.restored.append(path) 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[@]}" - -- cgit v1.2.3 From 3bec4688a7001a3ce9bbfd1a82e691ea94884a9e Mon Sep 17 00:00:00 2001 From: Harm Weites Date: Wed, 3 Sep 2014 17:20:43 +0000 Subject: fix: Since these now actually exist in ports, install them properly (with pkg). --- tools/build-on-freebsd | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 23bdf487..65d783f7 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -17,6 +17,7 @@ pkgs=" py27-prettytable py27-requests py27-six python py27-cheetah + py27-jsonpointer py27-jsonpatch " [ -f "$depschecked" ] || pkg install ${pkgs} || fail "install packages" touch $depschecked -- cgit v1.2.3