From 797016c54bca1d6492cecb4435ad0884af62bf6c Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 18 Dec 2019 09:32:20 +0100 Subject: [PATCH] Retire repository Fuel (from openstack namespace) and fuel-ccp (in x namespace) repositories are unused and ready to retire. This change removes all content from the repository and adds the usual README file to point out that the repository is retired following the process from https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project See also http://lists.openstack.org/pipermail/openstack-discuss/2019-December/011647.html Depends-On: https://review.opendev.org/699362 Change-Id: Icc6a810696788e65e9afd8be691400d4d39de313 --- .gitignore | 21 - LICENSE | 176 -- MAINTAINERS | 72 - README.md | 208 -- README.rst | 10 + cloud-init-templates/boothook_centos.jinja2 | 94 - .../boothook_fuel_6.1_centos.jinja2 | 89 - .../boothook_fuel_6.1_ubuntu.jinja2 | 72 - .../boothook_fuel_7.0_centos.jinja2 | 94 - .../boothook_fuel_7.0_ubuntu.jinja2 | 77 - .../boothook_fuel_8.0_ubuntu.jinja2 | 79 - .../boothook_fuel_9.0_ubuntu.jinja2 | 79 - cloud-init-templates/boothook_ubuntu.jinja2 | 104 - .../cloud_config_centos.jinja2 | 106 - .../cloud_config_fuel_6.1_ubuntu.jinja2 | 105 - .../cloud_config_fuel_7.0_ubuntu.jinja2 | 105 - .../cloud_config_fuel_8.0_ubuntu.jinja2 | 105 - .../cloud_config_fuel_9.0_ubuntu.jinja2 | 120 - .../cloud_config_ubuntu.jinja2 | 145 -- cloud-init-templates/meta_data_centos.jinja2 | 11 - cloud-init-templates/meta_data_json.jinja2 | 4 - cloud-init-templates/meta_data_ubuntu.jinja2 | 11 - contrib/fuel_bootstrap/files/README.md | 0 .../files/trusty/etc/e2fsck.conf | 16 - .../fuel_bootstrap/files/trusty/etc/hostname | 1 - .../files/trusty/etc/init/ttyS0.conf | 18 - .../files/trusty/etc/init/ttyS1.conf | 18 - .../fuel_bootstrap/files/trusty/etc/localtime | Bin 118 -> 0 bytes .../files/trusty/etc/logrotate.d/syslog | 28 - .../files/trusty/etc/mcollective/server.cfg | 27 - .../etc/modprobe.d/blacklist-i2c-piix4.conf | 1 - .../trusty/etc/modprobe.d/mlnx4_core.conf | 1 - .../fuel_bootstrap/files/trusty/etc/modules | 8 - .../files/trusty/etc/nailgun_systemtype | 1 - .../fuel_bootstrap/files/trusty/etc/rc.local | 7 - .../etc/rsyslog.d/50-default-template.conf | 6 - .../files/trusty/etc/send2syslog.conf | 22 - .../files/trusty/etc/ssh/sshd_config | 20 - .../lib/udev/rules.d/80-net-name-slot.rules | 20 - .../trusty/usr/bin/fix-configs-on-startup | 65 - .../files/trusty/usr/bin/multipath-reload | 28 - .../files/trusty/usr/bin/send2syslog.py | 505 ----- .../share/initramfs-tools/hooks/netifnames | 21 - .../files/xenial/etc/e2fsck.conf | 16 - .../fuel_bootstrap/files/xenial/etc/hostname | 1 - .../fuel_bootstrap/files/xenial/etc/localtime | Bin 118 -> 0 bytes .../files/xenial/etc/logrotate.d/syslog | 28 - .../files/xenial/etc/mcollective/server.cfg | 27 - .../fuel_bootstrap/files/xenial/etc/modules | 8 - .../files/xenial/etc/nailgun_systemtype | 1 - .../fuel_bootstrap/files/xenial/etc/rc.local | 4 - .../etc/rsyslog.d/50-default-template.conf | 6 - .../files/xenial/etc/send2syslog.conf | 22 - .../files/xenial/etc/ssh/sshd_config | 20 - .../xenial/usr/bin/fix-configs-on-startup | 87 - .../files/xenial/usr/bin/send2syslog.py | 505 ----- .../fuel_bootstrap/fuel_bootstrap_cli/AUTHORS | 1 - .../fuel_bootstrap_cli/MANIFEST.in | 5 - .../fuel_bootstrap_cli/README.md | 0 .../fuel_bootstrap_cli/README.rst | 0 .../fuel_bootstrap/__init__.py | 0 .../fuel_bootstrap/commands/__init__.py | 0 .../fuel_bootstrap/commands/activate.py | 39 - .../fuel_bootstrap/commands/base.py | 41 - .../fuel_bootstrap/commands/build.py | 183 -- .../fuel_bootstrap/commands/delete.py | 39 - .../fuel_bootstrap/commands/import.py | 49 - .../fuel_bootstrap/commands/list.py | 34 - .../fuel_bootstrap/consts.py | 53 - .../fuel_bootstrap/errors.py | 57 - .../fuel_bootstrap/hooks.py | 21 - .../fuel_bootstrap_cli/fuel_bootstrap/main.py | 59 - .../fuel_bootstrap/objects/__init__.py | 0 .../objects/master_node_settings.py | 34 - .../fuel_bootstrap/settings.py | 42 - .../fuel_bootstrap/settings.yaml.sample | 175 -- .../fuel_bootstrap/tests/__init__.py | 0 .../fuel_bootstrap/tests/base.py | 23 - .../fuel_bootstrap/tests/conftest.py | 59 - .../tests/test_activate_command.py | 31 - .../fuel_bootstrap/tests/test_app.py | 25 - .../tests/test_build_command.py | 77 - .../tests/test_delete_command.py | 32 - .../tests/test_import_command.py | 45 - .../fuel_bootstrap/tests/test_list_command.py | 39 - .../fuel_bootstrap/tests/test_requirements.py | 21 - .../tests/test_utils_bootstrap_image.py | 370 --- .../fuel_bootstrap/tests/test_utils_data.py | 241 -- .../fuel_bootstrap/utils/__init__.py | 0 .../fuel_bootstrap/utils/bootstrap_image.py | 270 --- .../fuel_bootstrap/utils/data.py | 185 -- .../fuel_bootstrap/utils/notifier.py | 45 - .../fuel_bootstrap_cli/requirements.txt | 10 - .../fuel_bootstrap_cli/setup.cfg | 39 - .../fuel_bootstrap_cli/setup.py | 29 - .../etc/fuel-agent/fuel-agent.conf | 8 - contrib/ironic/bootstrap-files/etc/hostname | 2 - .../ironic/bootstrap-files/etc/rsyslog.conf | 29 - .../etc/rsyslog.d/00-remote.conf | 36 - .../bootstrap-files/etc/ssh/sshd_config | 20 - .../ironic-callback.service | 1 - .../systemd/system/ironic-callback.service | 8 - .../usr/bin/configure-remote-logging.sh | 9 - .../usr/bin/ironic-callback.sh | 4 - contrib/ironic/ironic-fa-deploy/README.rst | 81 - .../ironic_fa_deploy/__init__.py | 0 .../ironic_fa_deploy/common/__init__.py | 0 .../ironic_fa_deploy/common/exception.py | 19 - .../ironic-fa-deploy/ironic_fa_deploy/fuel.py | 79 - .../ironic_fa_deploy/modules/__init__.py | 0 .../ironic_fa_deploy/modules/fuel_agent.py | 535 ----- .../modules/fuel_config.template | 6 - .../ironic_fa_deploy/modules/lib_virt.py | 537 ----- .../ironic/ironic-fa-deploy/requirements.txt | 4 - contrib/ironic/ironic-fa-deploy/setup.cfg | 22 - contrib/ironic/ironic-fa-deploy/setup.py | 20 - debian/changelog | 65 - debian/compat | 1 - debian/control | 80 - debian/copyright | 28 - debian/fuel-agent.install | 1 - debian/fuel-agent.postinst | 30 - debian/ironic-fa-bootstrap-configs.install | 1 - debian/ironic-fa-bootstrap-configs.postinst | 5 - debian/rules | 56 - debian/source/options | 1 - debian/source/source | 1 - etc/fuel-agent/fuel-agent.conf.sample | 217 -- fuel_agent/__init__.py | 0 fuel_agent/cmd/__init__.py | 0 fuel_agent/cmd/agent.py | 150 -- fuel_agent/cmd/ironic_callback.py | 94 - fuel_agent/drivers/__init__.py | 0 fuel_agent/drivers/base.py | 50 - fuel_agent/drivers/bootstrap.py | 25 - fuel_agent/drivers/ks_spaces_validator.py | 149 -- fuel_agent/drivers/nailgun.py | 858 ------- fuel_agent/drivers/simple.py | 67 - fuel_agent/errors.py | 188 -- fuel_agent/hooks.py | 21 - fuel_agent/manager.py | 1272 ----------- fuel_agent/objects/__init__.py | 75 - fuel_agent/objects/base.py | 41 - fuel_agent/objects/bootloader.py | 29 - fuel_agent/objects/configdrive.py | 123 - fuel_agent/objects/device.py | 28 - fuel_agent/objects/image.py | 45 - fuel_agent/objects/operating_system.py | 51 - fuel_agent/objects/partition/__init__.py | 0 fuel_agent/objects/partition/fs.py | 38 - fuel_agent/objects/partition/lv.py | 38 - fuel_agent/objects/partition/md.py | 54 - fuel_agent/objects/partition/parted.py | 161 -- fuel_agent/objects/partition/pv.py | 34 - fuel_agent/objects/partition/scheme.py | 270 --- fuel_agent/objects/partition/vg.py | 35 - fuel_agent/objects/repo.py | 46 - fuel_agent/objects/users.py | 39 - fuel_agent/openstack/__init__.py | 0 fuel_agent/tests/__init__.py | 0 fuel_agent/tests/base.py | 27 - .../tests/fixtures/simple_nailgun_driver.json | 349 --- fuel_agent/tests/test_artifact_utils.py | 134 -- fuel_agent/tests/test_build_utils.py | 940 -------- fuel_agent/tests/test_configdrive.py | 81 - fuel_agent/tests/test_fs_utils.py | 213 -- fuel_agent/tests/test_grub_utils.py | 490 ---- fuel_agent/tests/test_hardware_utils.py | 541 ----- fuel_agent/tests/test_image.py | 26 - fuel_agent/tests/test_ks_spaces_validator.py | 204 -- fuel_agent/tests/test_lvm_utils.py | 436 ---- fuel_agent/tests/test_manager.py | 1365 ----------- fuel_agent/tests/test_md_utils.py | 297 --- fuel_agent/tests/test_nailgun.py | 1991 ----------------- fuel_agent/tests/test_nailgun_build_image.py | 237 -- fuel_agent/tests/test_partition.py | 445 ---- fuel_agent/tests/test_partition_utils.py | 330 --- fuel_agent/tests/test_provision_utils.py | 116 - fuel_agent/tests/test_requirements.py | 21 - .../tests/test_simple_nailgun_driver.py | 241 -- fuel_agent/tests/test_utils.py | 547 ----- fuel_agent/utils/__init__.py | 0 fuel_agent/utils/artifact.py | 231 -- fuel_agent/utils/build.py | 1063 --------- fuel_agent/utils/decorators.py | 39 - fuel_agent/utils/fs.py | 135 -- fuel_agent/utils/grub.py | 254 --- fuel_agent/utils/hardware.py | 398 ---- fuel_agent/utils/lvm.py | 255 --- fuel_agent/utils/md.py | 186 -- fuel_agent/utils/partition.py | 211 -- fuel_agent/utils/provision.py | 100 - fuel_agent/utils/utils.py | 447 ---- fuel_agent/version.py | 17 - requirements.txt | 14 - run_tests.sh | 20 - setup.cfg | 53 - setup.py | 20 - specs/fuel-agent.spec | 133 -- test-requirements.txt | 6 - tools/config/check_uptodate.sh | 25 - tools/config/generate_sample.sh | 126 -- tools/config/oslo.config.generator.rc | 0 tools/with_venv.sh | 7 - tox.ini | 43 - 205 files changed, 10 insertions(+), 24489 deletions(-) delete mode 100644 .gitignore delete mode 100644 LICENSE delete mode 100644 MAINTAINERS delete mode 100644 README.md create mode 100644 README.rst delete mode 100644 cloud-init-templates/boothook_centos.jinja2 delete mode 100644 cloud-init-templates/boothook_fuel_6.1_centos.jinja2 delete mode 100644 cloud-init-templates/boothook_fuel_6.1_ubuntu.jinja2 delete mode 100644 cloud-init-templates/boothook_fuel_7.0_centos.jinja2 delete mode 100644 cloud-init-templates/boothook_fuel_7.0_ubuntu.jinja2 delete mode 100644 cloud-init-templates/boothook_fuel_8.0_ubuntu.jinja2 delete mode 100644 cloud-init-templates/boothook_fuel_9.0_ubuntu.jinja2 delete mode 100644 cloud-init-templates/boothook_ubuntu.jinja2 delete mode 100644 cloud-init-templates/cloud_config_centos.jinja2 delete mode 100644 cloud-init-templates/cloud_config_fuel_6.1_ubuntu.jinja2 delete mode 100644 cloud-init-templates/cloud_config_fuel_7.0_ubuntu.jinja2 delete mode 100644 cloud-init-templates/cloud_config_fuel_8.0_ubuntu.jinja2 delete mode 100644 cloud-init-templates/cloud_config_fuel_9.0_ubuntu.jinja2 delete mode 100644 cloud-init-templates/cloud_config_ubuntu.jinja2 delete mode 100644 cloud-init-templates/meta_data_centos.jinja2 delete mode 100644 cloud-init-templates/meta_data_json.jinja2 delete mode 100644 cloud-init-templates/meta_data_ubuntu.jinja2 delete mode 100644 contrib/fuel_bootstrap/files/README.md delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/e2fsck.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/hostname delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/init/ttyS0.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/init/ttyS1.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/localtime delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/logrotate.d/syslog delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/mcollective/server.cfg delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/blacklist-i2c-piix4.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/mlnx4_core.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/modules delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/nailgun_systemtype delete mode 100755 contrib/fuel_bootstrap/files/trusty/etc/rc.local delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/rsyslog.d/50-default-template.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/send2syslog.conf delete mode 100644 contrib/fuel_bootstrap/files/trusty/etc/ssh/sshd_config delete mode 100755 contrib/fuel_bootstrap/files/trusty/lib/udev/rules.d/80-net-name-slot.rules delete mode 100755 contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup delete mode 100755 contrib/fuel_bootstrap/files/trusty/usr/bin/multipath-reload delete mode 100755 contrib/fuel_bootstrap/files/trusty/usr/bin/send2syslog.py delete mode 100755 contrib/fuel_bootstrap/files/trusty/usr/share/initramfs-tools/hooks/netifnames delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/e2fsck.conf delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/hostname delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/localtime delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/logrotate.d/syslog delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/mcollective/server.cfg delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/modules delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/nailgun_systemtype delete mode 100755 contrib/fuel_bootstrap/files/xenial/etc/rc.local delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/rsyslog.d/50-default-template.conf delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/send2syslog.conf delete mode 100644 contrib/fuel_bootstrap/files/xenial/etc/ssh/sshd_config delete mode 100755 contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup delete mode 100755 contrib/fuel_bootstrap/files/xenial/usr/bin/send2syslog.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/AUTHORS delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/MANIFEST.in delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/README.md delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/README.rst delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/__init__.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/__init__.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/activate.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/base.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/build.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/delete.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/import.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/list.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/consts.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/errors.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/hooks.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/main.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/__init__.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/master_node_settings.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.yaml.sample delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/__init__.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/base.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/conftest.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_activate_command.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_app.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_build_command.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_delete_command.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_import_command.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_list_command.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_requirements.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_bootstrap_image.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_data.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/__init__.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/bootstrap_image.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/data.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/notifier.py delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/requirements.txt delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/setup.cfg delete mode 100644 contrib/fuel_bootstrap/fuel_bootstrap_cli/setup.py delete mode 100644 contrib/ironic/bootstrap-files/etc/fuel-agent/fuel-agent.conf delete mode 100644 contrib/ironic/bootstrap-files/etc/hostname delete mode 100644 contrib/ironic/bootstrap-files/etc/rsyslog.conf delete mode 100644 contrib/ironic/bootstrap-files/etc/rsyslog.d/00-remote.conf delete mode 100644 contrib/ironic/bootstrap-files/etc/ssh/sshd_config delete mode 120000 contrib/ironic/bootstrap-files/etc/systemd/system/default.target.wants/ironic-callback.service delete mode 100644 contrib/ironic/bootstrap-files/lib/systemd/system/ironic-callback.service delete mode 100755 contrib/ironic/bootstrap-files/usr/bin/configure-remote-logging.sh delete mode 100755 contrib/ironic/bootstrap-files/usr/bin/ironic-callback.sh delete mode 100644 contrib/ironic/ironic-fa-deploy/README.rst delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/__init__.py delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/common/__init__.py delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/common/exception.py delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/fuel.py delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/modules/__init__.py delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/modules/fuel_agent.py delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/modules/fuel_config.template delete mode 100644 contrib/ironic/ironic-fa-deploy/ironic_fa_deploy/modules/lib_virt.py delete mode 100644 contrib/ironic/ironic-fa-deploy/requirements.txt delete mode 100644 contrib/ironic/ironic-fa-deploy/setup.cfg delete mode 100644 contrib/ironic/ironic-fa-deploy/setup.py delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/fuel-agent.install delete mode 100644 debian/fuel-agent.postinst delete mode 100644 debian/ironic-fa-bootstrap-configs.install delete mode 100644 debian/ironic-fa-bootstrap-configs.postinst delete mode 100755 debian/rules delete mode 100644 debian/source/options delete mode 100644 debian/source/source delete mode 100644 etc/fuel-agent/fuel-agent.conf.sample delete mode 100644 fuel_agent/__init__.py delete mode 100644 fuel_agent/cmd/__init__.py delete mode 100644 fuel_agent/cmd/agent.py delete mode 100755 fuel_agent/cmd/ironic_callback.py delete mode 100644 fuel_agent/drivers/__init__.py delete mode 100644 fuel_agent/drivers/base.py delete mode 100644 fuel_agent/drivers/bootstrap.py delete mode 100644 fuel_agent/drivers/ks_spaces_validator.py delete mode 100644 fuel_agent/drivers/nailgun.py delete mode 100644 fuel_agent/drivers/simple.py delete mode 100644 fuel_agent/errors.py delete mode 100644 fuel_agent/hooks.py delete mode 100644 fuel_agent/manager.py delete mode 100644 fuel_agent/objects/__init__.py delete mode 100644 fuel_agent/objects/base.py delete mode 100644 fuel_agent/objects/bootloader.py delete mode 100644 fuel_agent/objects/configdrive.py delete mode 100644 fuel_agent/objects/device.py delete mode 100644 fuel_agent/objects/image.py delete mode 100644 fuel_agent/objects/operating_system.py delete mode 100644 fuel_agent/objects/partition/__init__.py delete mode 100644 fuel_agent/objects/partition/fs.py delete mode 100644 fuel_agent/objects/partition/lv.py delete mode 100644 fuel_agent/objects/partition/md.py delete mode 100644 fuel_agent/objects/partition/parted.py delete mode 100644 fuel_agent/objects/partition/pv.py delete mode 100644 fuel_agent/objects/partition/scheme.py delete mode 100644 fuel_agent/objects/partition/vg.py delete mode 100644 fuel_agent/objects/repo.py delete mode 100644 fuel_agent/objects/users.py delete mode 100644 fuel_agent/openstack/__init__.py delete mode 100644 fuel_agent/tests/__init__.py delete mode 100644 fuel_agent/tests/base.py delete mode 100644 fuel_agent/tests/fixtures/simple_nailgun_driver.json delete mode 100644 fuel_agent/tests/test_artifact_utils.py delete mode 100644 fuel_agent/tests/test_build_utils.py delete mode 100644 fuel_agent/tests/test_configdrive.py delete mode 100644 fuel_agent/tests/test_fs_utils.py delete mode 100644 fuel_agent/tests/test_grub_utils.py delete mode 100644 fuel_agent/tests/test_hardware_utils.py delete mode 100644 fuel_agent/tests/test_image.py delete mode 100644 fuel_agent/tests/test_ks_spaces_validator.py delete mode 100644 fuel_agent/tests/test_lvm_utils.py delete mode 100644 fuel_agent/tests/test_manager.py delete mode 100644 fuel_agent/tests/test_md_utils.py delete mode 100644 fuel_agent/tests/test_nailgun.py delete mode 100644 fuel_agent/tests/test_nailgun_build_image.py delete mode 100644 fuel_agent/tests/test_partition.py delete mode 100644 fuel_agent/tests/test_partition_utils.py delete mode 100644 fuel_agent/tests/test_provision_utils.py delete mode 100644 fuel_agent/tests/test_requirements.py delete mode 100644 fuel_agent/tests/test_simple_nailgun_driver.py delete mode 100644 fuel_agent/tests/test_utils.py delete mode 100644 fuel_agent/utils/__init__.py delete mode 100644 fuel_agent/utils/artifact.py delete mode 100644 fuel_agent/utils/build.py delete mode 100644 fuel_agent/utils/decorators.py delete mode 100644 fuel_agent/utils/fs.py delete mode 100644 fuel_agent/utils/grub.py delete mode 100644 fuel_agent/utils/hardware.py delete mode 100644 fuel_agent/utils/lvm.py delete mode 100644 fuel_agent/utils/md.py delete mode 100644 fuel_agent/utils/partition.py delete mode 100644 fuel_agent/utils/provision.py delete mode 100644 fuel_agent/utils/utils.py delete mode 100644 fuel_agent/version.py delete mode 100644 requirements.txt delete mode 100755 run_tests.sh delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 specs/fuel-agent.spec delete mode 100644 test-requirements.txt delete mode 100755 tools/config/check_uptodate.sh delete mode 100755 tools/config/generate_sample.sh delete mode 100644 tools/config/oslo.config.generator.rc delete mode 100755 tools/with_venv.sh delete mode 100644 tox.ini diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a433d9f2..00000000 --- a/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -.venv -*.pyc - -# vim swap files -.*.swp - -# services' runtime files -*.log -*.pid - -build -dist - -*.egg -*.eggs -.testrepository -.cache -.tox -.idea -.DS_Store -*.egg-info diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68c771a0..00000000 --- a/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index f348e5e2..00000000 --- a/MAINTAINERS +++ /dev/null @@ -1,72 +0,0 @@ ---- -description: - For Fuel team structure and contribution policy, see [1]. - - This is repository level MAINTAINERS file. All contributions to this - repository must be approved by one or more Core Reviewers [2]. - If you are contributing to files (or create new directories) in - root folder of this repository, please contact Core Reviewers for - review and merge requests. - - If you are contributing to subfolders of this repository, please - check 'maintainers' section of this file in order to find maintainers - for those specific modules. - - It is mandatory to get +1 from one or more maintainers before asking - Core Reviewers for review/merge in order to decrease a load on Core Reviewers [3]. - Exceptions are when maintainers are actually cores, or when maintainers - are not available for some reason (e.g. on vacation). - - [1] https://specs.openstack.org/openstack/fuel-specs/policy/team-structure - [2] https://review.openstack.org/#/admin/groups/995,members - [3] http://lists.openstack.org/pipermail/openstack-dev/2015-August/072406.html - - Please keep this file in YAML format in order to allow helper scripts - to read this as a configuration data. - -maintainers: - -- ./: - - name: Alexander Gordeev - email: agordeev@mirantis.com - IRC: agordeev - - - name: Vladimir Kozhukalov - email: vkozhukalov@mirantis.com - IRC: kozhukalov - -- specs/: &MOS_packaging_team - - name: Mikhail Ivanov - email: mivanov@mirantis.com - IRC: mivanov - - - name: Artem Silenkov - email: asilenkov@mirantis.com - IRC: asilenkov - - - name: Alexander Tsamutali - email: atsamutali@mirantis.com - IRC: astsmtl - - - name: Daniil Trishkin - email: dtrishkin@mirantis.com - IRC: dtrishkin - - - name: Ivan Udovichenko - email: iudovichenko@mirantis.com - IRC: tlbr - - - name: Igor Yozhikov - email: iyozhikov@mirantis.com - IRC: IgorYozhikov - -- debian/: *MOS_packaging_team - -- contrib/fuel_bootstrap: - - name: Artur Svechnikov - email: asvechnikov@mirantis.com - IRC: asvechnikov - - - name: Aleksey Zvyagintsev - email: azvyagintsev@mirantis.com - IRC: azvyagintsev diff --git a/README.md b/README.md deleted file mode 100644 index 2fe22b58..00000000 --- a/README.md +++ /dev/null @@ -1,208 +0,0 @@ -Team and repository tags -======================== - -[![Team and repository tags](http://governance.openstack.org/badges/fuel-agent.svg)](http://governance.openstack.org/reference/tags/index.html) - - - -fuel-agent README -================= - -## Table of Contents - -- [Overview](#overview) -- [Structure](#structure) -- [Usage](#usage) -- [Development](#development) -- [Core Reviewers](#core-reviewers) -- [Contributors](#contributors) - -## Overview - -fuel-agent is nothing more than just a set of data driven executable -scripts. -- One of these scripts is used for building operating system images. One can run -this script on wherever needed passing a set of repository URIs and a set of -package names that are to be installed into the image. -- Another script is used for the actual provisioning. This script being installed -into a ramdisk (live image) can be run to provision an operating system on a hard drive. -When running one needs to pass input data that contain information about disk -partitions, initial node configuration, operating system image location, etc. -This script is to prepare disk partitions according to the input data, download -operating system images and put these images on partitions. - - -### Motivation -- Native operating installation tools like anaconda and debian-installer are: - * hard to customize (if the case is really non-trivial) - * hard to troubleshoot (it is usually quite difficult to understand which log file - contains necessary information and how to run those tools in debug mode) -- Image based approach to operating system installation allows to make this - process really scalable. For example, we can use BitTorrent based image - delivery scheme when provisioning that makes the process easily scalable up - to thousands of nodes. -- When provisioning we can check hash sum of the image and use other validation - mechanisms that can make the process more stable. - - -### Designed to address requirements -- Support various input data formats (pluggable input data drivers) -- Support plain partitions, lvm, md, root on lvm, etc. -- Be able to do initial node configuration (network, mcollective, puppet, ntp) -- Be able to deploy standalone OS (local kernel, local bootloader) -- Support various image storages (tftp, http, torrent) -- Support various image formats (compressed, disk image, fs image, tar image) - -### Design outline -- Use cloud-init for initial node configuration -- Avoid using parted and lvm native python bindings (to make it easy to - troubleshoot and modify for deployment engineers) -- No REST API, just executable entry points (like /usr/bin/fa_*) -- Passing input data either via file (--input_data_file) or CLI parameter (--input_data) -- Detailed logging of all components - - -## Structure - -### Basic Repository Layout - -``` -fuel-agent -├── cloud-init-templates -├── contrib -├── debian -├── etc -├── fuel_agent -│   ├── cmd -│   ├── drivers -│   ├── objects -│   ├── openstack -│   ├── tests -│   ├── utils -├── README.md -├── LICENSE -├── requirements.txt -├── run_tests.sh -├── setup.cfg -├── setup.py -├── specs -├── test-requirements.txt -``` - -### root - -The root level contains important repository documentation and license information. -It also contais files which are typical for the infracture of python project such -as requirements.txt and setup.py - -### cloud-init-templates - -This folder contains Jinja2 templates to prepare [cloud-init](https://cloudinit.readthedocs.org/en/latest/) related data for [nocloud](http://cloudinit.readthedocs.org/en/latest/topics/datasources.html#no-cloud) [datasource](http://cloudinit.readthedocs.org/en/latest/topics/datasources.html#what-is-a-datasource). - -### contrib - -This directory contains third party code that is not a part of fuel-agent itself but -can be used together with fuel-agent. - -### debian - -This folder contains the DEB package specification. -Included debian rules are mainly suitable for Ubuntu 12.04 or higher. - -### etc - -This folder contains the sample config file for fuel-agent. Every parameter is well documented. -We use oslo-config as a configuration module. - -### fuel_agent - -This folder contains the python code: drivers, objects, unit tests and utils, manager and entry points. - -- fuel_agent/cmd/agent.py - * That is where executable entry points are. It reads input data and - instantiates Manager class with these data. -- fuel_agent/manager.py - * That is the file where the top level agent logic is implemented. - It contains all those methods which do something useful (do_*) -- fuel_agent/drivers - * That is where input data drivers are located. - (Nailgun, NailgunBuildImage, Simple etc.) - Data drivers convert json into a set of python objects. -- fuel_agent/objects - * Here is the place where python objects are defined. fuel-agent manager - does not understand any particular data format except these objects. - For example, to do disk partitioning we need PartitionScheme object. - PartitionScheme object in turn contains disk labels, plain partitions, - lvm, md, fs objects. This PartitionScheme object is to be created by input - data driver. -- fuel_agent/utils - * That is the place where we put the code which does something useful on the OS - level. Here we have simple parted, lvm, md, grub bindings, etc. - -### specs - -This folder contains the RPM package specfication file. -Included RPM spec is mainly suitable for Centos 6.x or higher. - - -## Usage - -### Use case #1 (Fuel) - -fuel-agent is used in Fuel project as a part of operating system provisioning scheme. -When a user starts deployment of OpenStack cluster, the first task is to install -an operating system on slave nodes. First, Fuel runs fuel-agent on the master node -to build OS images. Once images are built, Fuel then runs fuel-agent on slave nodes -using Mcollective. Slave nodes are supposed to be booted with so called bootstrap ramdisk. -Bootstrap ramdisk is an in-memory OS where fuel-agent is installed. - -Detailed documentation on this case is available here: -* [Image based provisionig](https://docs.mirantis.com/openstack/fuel/fuel-master/reference-architecture.html#image-based-provisioning) -* [fuel-agent](https://docs.mirantis.com/openstack/fuel/fuel-master/reference-architecture.html#fuel-agent) -* [Operating system provisioning](https://docs.mirantis.com/openstack/fuel/fuel-master/reference-architecture.html#operating-system-provisioning) -* [Image building](https://docs.mirantis.com/openstack/fuel/fuel-master/reference-architecture.html#image-building) - -### Use case #2 (Independent on Fuel) - -fuel-agent can easily be used in third party projects as a convenient operating system -provisioning tool. As described above fuel-agent is fully data driven and supports -various input data formats using pluggable input data drivers. Currently there are three -input data drivers available. Those are - -- NailgunBuildImage and Nailgun - * Build image and provisioning input data drivers used in Fuel project. To use them - independently read Fuel documentation. -- NailgunSimpleDriver - * fuel-agent native partitioning input data driver. It is just a de-serializer for - fuel-agent PartitionScheme object. - -In order to be able to use another specific data format one can implement his own data -driver and install it independently. fuel-agent uses stevedore to find installed drivers. -A new driver needs to be exposed via fuel_agent.driver setuptools name space. See for example -setup.cfg file where entry points are defined. - -One can also take a look at ```contrib``` directory for some additional examples. - - -### How to install - -fuel-agent can be installed either using RPM/DEB packages or using ```python setup.py install```. - - -## Development - -fuel-agent currently is a subproject of Fuel project. So, we follow the same development -practices as Fuel itself. - -* [Fuel Development Documentation](https://docs.fuel-infra.org/fuel-dev/) -* [Fuel How to Contribute](https://wiki.openstack.org/wiki/Fuel/How_to_contribute) - - -## Core Reviewers - -* [fuel-agent cores](https://review.openstack.org/#/admin/groups/995,members) - - -## Contributors - -* [Stackalytics](http://stackalytics.com/?release=all&project_type=all&module=fuel-agent&metric=commits) diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..86e34d67 --- /dev/null +++ b/README.rst @@ -0,0 +1,10 @@ +This project is no longer maintained. + +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". + +For any further questions, please email +openstack-discuss@lists.openstack.org or join #openstack-dev on +Freenode. diff --git a/cloud-init-templates/boothook_centos.jinja2 b/cloud-init-templates/boothook_centos.jinja2 deleted file mode 100644 index 5e39e14d..00000000 --- a/cloud-init-templates/boothook_centos.jinja2 +++ /dev/null @@ -1,94 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - - -cloud-init-per instance disable_selinux_on_the_fly setenforce 0 - -cloud-init-per instance disable_selinux sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip }} | tee -a /etc/resolv.conf' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/rc.modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/rc.modules' -cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/rc.modules' -cloud-init-per instance chmod_rc_modules chmod +x /etc/rc.modules -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' -cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" -cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60" - -cloud-init-per instance mkdir_coredump mkdir -p /var/log/coredump -cloud-init-per instance set_coredump /bin/sh -c 'echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" | tee -a /etc/sysctl.conf' -cloud-init-per instance set_coredump_sysctl sysctl -w "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" -cloud-init-per instance set_chmod chmod 777 /var/log/coredump -cloud-init-per instance set_limits /bin/sh -c 'echo -e "* soft core unlimited\n* hard core unlimited" | tee -a /etc/security/limits.conf' - - -#NOTE: disabled for centos? -#cloud-init-per instance dhclient echo 'supersede routers 0;' | tee /etc/dhcp/dhclient.conf - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntpd /bin/sh -c 'service ntpd stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/drift' -cloud-init-per instance edit_ntp_conf4 chown ntp: /var/lib/ntp/drift -cloud-init-per instance edit_ntp_conf5 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf6 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' - - -# Point installed ntpd to Master node -cloud-init-per instance set_ntpdate sed -i 's/SYNC_HWCLOCK\s*=\s*no/SYNC_HWCLOCK=yes/' /etc/sysconfig/ntpdate -cloud-init-per instance set_ntpd_0 chkconfig ntpd on -cloud-init-per instance set_ntpd_1 chkconfig ntpdate on -cloud-init-per instance start_ntpd service ntpd start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/usr/bin/nailgun-agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -# Puppet config -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log -cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log - -# Mcollective enable -cloud-init-per instance mcollective_enable sed -i /etc/rc.d/init.d/mcollective -e 's/\(# chkconfig:\s\+[-0-6]\+\) [0-9]\+ \([0-9]\+\)/\1 81 \2/' diff --git a/cloud-init-templates/boothook_fuel_6.1_centos.jinja2 b/cloud-init-templates/boothook_fuel_6.1_centos.jinja2 deleted file mode 100644 index 14524eca..00000000 --- a/cloud-init-templates/boothook_fuel_6.1_centos.jinja2 +++ /dev/null @@ -1,89 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - - -cloud-init-per instance disable_selinux_on_the_fly setenforce 0 - -cloud-init-per instance disable_selinux sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip }} | tee -a /etc/resolv.conf' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/rc.modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/rc.modules' -cloud-init-per instance chmod_rc_modules chmod +x /etc/rc.modules -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" - -cloud-init-per instance mkdir_coredump mkdir -p /var/log/coredump -cloud-init-per instance set_coredump /bin/sh -c 'echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" | tee -a /etc/sysctl.conf' -cloud-init-per instance set_coredump_sysctl sysctl -w "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" -cloud-init-per instance set_chmod chmod 777 /var/log/coredump -cloud-init-per instance set_limits /bin/sh -c 'echo -e "* soft core unlimited\n* hard core unlimited" | tee -a /etc/security/limits.conf' - - -#NOTE: disabled for centos? -#cloud-init-per instance dhclient echo 'supersede routers 0;' | tee /etc/dhcp/dhclient.conf - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntpd /bin/sh -c 'service ntpd stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/drift' -cloud-init-per instance edit_ntp_conf4 chown ntp: /var/lib/ntp/drift -cloud-init-per instance edit_ntp_conf5 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf6 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' - - -# Point installed ntpd to Master node -cloud-init-per instance set_ntpdate sed -i 's/SYNC_HWCLOCK\s*=\s*no/SYNC_HWCLOCK=yes/' /etc/sysconfig/ntpdate -cloud-init-per instance set_ntpd_0 chkconfig ntpd on -cloud-init-per instance set_ntpd_1 chkconfig ntpdate on -cloud-init-per instance start_ntpd service ntpd start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/opt/nailgun/bin/agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -# Puppet config -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml - -# Mcollective enable -cloud-init-per instance mcollective_enable sed -i /etc/rc.d/init.d/mcollective -e 's/\(# chkconfig:\s\+[-0-6]\+\) [0-9]\+ \([0-9]\+\)/\1 81 \2/' diff --git a/cloud-init-templates/boothook_fuel_6.1_ubuntu.jinja2 b/cloud-init-templates/boothook_fuel_6.1_ubuntu.jinja2 deleted file mode 100644 index 4753f2af..00000000 --- a/cloud-init-templates/boothook_fuel_6.1_ubuntu.jinja2 +++ /dev/null @@ -1,72 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - -cloud-init-per instance wipe_sources_list_templates /bin/sh -c 'echo | tee /etc/cloud/templates/sources.list.ubuntu.tmpl' - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_mkdir mkdir -p /etc/resolvconf/resolv.conf.d -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_head_remove rm -f /etc/resolvconf/resolv.conf.d/head -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolvconf/resolv.conf.d/head' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) && update-initramfs -u -k all - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/modules' -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" - -cloud-init-per instance dhclient /bin/sh -c 'echo "supersede routers 0;" | tee /etc/dhcp/dhclient.conf' - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntp /bin/sh -c 'service ntp stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/drift' -cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf5 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' -cloud-init-per instance start_ntp service ntp start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/opt/nailgun/bin/agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml diff --git a/cloud-init-templates/boothook_fuel_7.0_centos.jinja2 b/cloud-init-templates/boothook_fuel_7.0_centos.jinja2 deleted file mode 100644 index 339dcfa4..00000000 --- a/cloud-init-templates/boothook_fuel_7.0_centos.jinja2 +++ /dev/null @@ -1,94 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - - -cloud-init-per instance disable_selinux_on_the_fly setenforce 0 - -cloud-init-per instance disable_selinux sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip }} | tee -a /etc/resolv.conf' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/rc.modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/rc.modules' -cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/rc.modules' -cloud-init-per instance chmod_rc_modules chmod +x /etc/rc.modules -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' -cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" -cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60" - -cloud-init-per instance mkdir_coredump mkdir -p /var/log/coredump -cloud-init-per instance set_coredump /bin/sh -c 'echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" | tee -a /etc/sysctl.conf' -cloud-init-per instance set_coredump_sysctl sysctl -w "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" -cloud-init-per instance set_chmod chmod 777 /var/log/coredump -cloud-init-per instance set_limits /bin/sh -c 'echo -e "* soft core unlimited\n* hard core unlimited" | tee -a /etc/security/limits.conf' - - -#NOTE: disabled for centos? -#cloud-init-per instance dhclient echo 'supersede routers 0;' | tee /etc/dhcp/dhclient.conf - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntpd /bin/sh -c 'service ntpd stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/drift' -cloud-init-per instance edit_ntp_conf4 chown ntp: /var/lib/ntp/drift -cloud-init-per instance edit_ntp_conf5 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf6 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' - - -# Point installed ntpd to Master node -cloud-init-per instance set_ntpdate sed -i 's/SYNC_HWCLOCK\s*=\s*no/SYNC_HWCLOCK=yes/' /etc/sysconfig/ntpdate -cloud-init-per instance set_ntpd_0 chkconfig ntpd on -cloud-init-per instance set_ntpd_1 chkconfig ntpdate on -cloud-init-per instance start_ntpd service ntpd start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/opt/nailgun/bin/agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -# Puppet config -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log -cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log - -# Mcollective enable -cloud-init-per instance mcollective_enable sed -i /etc/rc.d/init.d/mcollective -e 's/\(# chkconfig:\s\+[-0-6]\+\) [0-9]\+ \([0-9]\+\)/\1 81 \2/' diff --git a/cloud-init-templates/boothook_fuel_7.0_ubuntu.jinja2 b/cloud-init-templates/boothook_fuel_7.0_ubuntu.jinja2 deleted file mode 100644 index 73d5ea00..00000000 --- a/cloud-init-templates/boothook_fuel_7.0_ubuntu.jinja2 +++ /dev/null @@ -1,77 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - -cloud-init-per instance wipe_sources_list_templates /bin/sh -c 'echo | tee /etc/cloud/templates/sources.list.ubuntu.tmpl' - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_mkdir mkdir -p /etc/resolvconf/resolv.conf.d -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_head_remove rm -f /etc/resolvconf/resolv.conf.d/head -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolvconf/resolv.conf.d/head' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) && update-initramfs -u -k all - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/modules' -cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/modules' -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' -cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" -cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60" - -cloud-init-per instance dhclient /bin/sh -c 'echo "supersede routers 0;" | tee /etc/dhcp/dhclient.conf' - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntp /bin/sh -c 'service ntp stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/drift' -cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf5 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' -cloud-init-per instance start_ntp service ntp start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/opt/nailgun/bin/agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log -cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log diff --git a/cloud-init-templates/boothook_fuel_8.0_ubuntu.jinja2 b/cloud-init-templates/boothook_fuel_8.0_ubuntu.jinja2 deleted file mode 100644 index e5eaf9cc..00000000 --- a/cloud-init-templates/boothook_fuel_8.0_ubuntu.jinja2 +++ /dev/null @@ -1,79 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - -cloud-init-per instance wipe_sources_list_templates /bin/sh -c 'echo | tee /etc/cloud/templates/sources.list.ubuntu.tmpl' - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_mkdir mkdir -p /etc/resolvconf/resolv.conf.d -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_head_remove rm -f /etc/resolvconf/resolv.conf.d/head -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolvconf/resolv.conf.d/head' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) && update-initramfs -u -k all - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/modules' -cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/modules' -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' -cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" -cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60" - -cloud-init-per instance dhclient /bin/sh -c 'echo "supersede routers 0;" | tee /etc/dhcp/dhclient.conf' - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntp /bin/sh -c 'service ntp stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf_chown_dir chown ntp: /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/ntp.drift' -cloud-init-per instance edit_ntp_conf_chown_drift chown ntp: /var/lib/ntp/ntp.drift -cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf5 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' -cloud-init-per instance start_ntp service ntp start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/usr/bin/nailgun-agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log -cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log diff --git a/cloud-init-templates/boothook_fuel_9.0_ubuntu.jinja2 b/cloud-init-templates/boothook_fuel_9.0_ubuntu.jinja2 deleted file mode 100644 index e5eaf9cc..00000000 --- a/cloud-init-templates/boothook_fuel_9.0_ubuntu.jinja2 +++ /dev/null @@ -1,79 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - -cloud-init-per instance wipe_sources_list_templates /bin/sh -c 'echo | tee /etc/cloud/templates/sources.list.ubuntu.tmpl' - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_mkdir mkdir -p /etc/resolvconf/resolv.conf.d -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_head_remove rm -f /etc/resolvconf/resolv.conf.d/head -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolvconf/resolv.conf.d/head' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) && update-initramfs -u -k all - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/modules' -cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/modules' -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' -cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" -cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60" - -cloud-init-per instance dhclient /bin/sh -c 'echo "supersede routers 0;" | tee /etc/dhcp/dhclient.conf' - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntp /bin/sh -c 'service ntp stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf_chown_dir chown ntp: /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/ntp.drift' -cloud-init-per instance edit_ntp_conf_chown_drift chown ntp: /var/lib/ntp/ntp.drift -cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf5 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' -cloud-init-per instance start_ntp service ntp start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/usr/bin/nailgun-agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log -cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log diff --git a/cloud-init-templates/boothook_ubuntu.jinja2 b/cloud-init-templates/boothook_ubuntu.jinja2 deleted file mode 100644 index 42577ad6..00000000 --- a/cloud-init-templates/boothook_ubuntu.jinja2 +++ /dev/null @@ -1,104 +0,0 @@ -#cloud-boothook -#!/bin/bash - -function add_str_to_file_if_not_exists { - file=$1 - str=$2 - val=$3 - if ! grep -q "^ *${str}" $file; then - echo $val >> $file - fi -} - -cloud-init-per instance wipe_sources_list_templates /bin/sh -c 'echo | tee /etc/cloud/templates/sources.list.ubuntu.tmpl' - -#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned, -# cloud-init will start to generate resolv.conf with non-actual data -cloud-init-per instance resolv_conf_mkdir mkdir -p /etc/resolvconf/resolv.conf.d -cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf -cloud-init-per instance resolv_conf_head_remove rm -f /etc/resolvconf/resolv.conf.d/head -cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf' -cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_head_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolvconf/resolv.conf.d/head' -cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolv.conf' -cloud-init-per instance resolv_conf_head_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip|replace('"','') }} | tee -a /etc/resolvconf/resolv.conf.d/head' - -# configure black module lists -# virt-what should be installed -if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then - ( (virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :) && update-initramfs -u -k all - modprobe -r i2c_piix4 -fi - -cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/modules' -cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/modules' -cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/modules' -cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf' -cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf' - -cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4 -cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6 -cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre -cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576" -cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60" - -cloud-init-per instance dhclient /bin/sh -c 'echo "supersede routers 0;" | tee /etc/dhcp/dhclient.conf' - -# ntp sync -# '| tee /dev/null' is needed for returning zero execution code always -cloud-init-per instance stop_ntp /bin/sh -c 'service ntp stop | tee /dev/null' -cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }} -cloud-init-per instance sync_hwclock hwclock --systohc - -cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf_chown_dir chown ntp: /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/ntp.drift' -cloud-init-per instance edit_ntp_conf_chown_drift chown ntp: /var/lib/ntp/ntp.drift -cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf -cloud-init-per instance edit_ntp_conf5 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' -cloud-init-per instance start_ntp service ntp start - -cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config -add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no' - -cloud-init-per instance gssapi_disable sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -cloud-init-per instance nailgun_agent_0 /bin/sh -c 'echo "#!/bin/sh" | tee /etc/rc.local' -cloud-init-per instance nailgun_agent_1 /bin/sh -c 'echo "rm -f /etc/nailgun-agent/nodiscover" | tee -a /etc/rc.local' -cloud-init-per instance nailgun_agent_2 /bin/sh -c 'echo "flock -w 0 -o /var/lock/agent.lock -c \"/usr/bin/nailgun-agent >> /var/log/nailgun-agent.log 2>&1\"" | tee -a /etc/rc.local' - -# Copying default bash settings to the root directory -cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ - -cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera -cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log -cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log - -cloud-init-per instance upstart_console /bin/sh -c 'for i in $(seq 0 1); do -cat >/etc/init/ttyS${i}.conf <<-EOF -# ttyS${i} - getty - -start on stopped rc RUNLEVEL=[12345] -stop on runlevel [!12345] - -respawn - -pre-start script - # exit if console not present on ttyS${i} - cat /proc/cmdline | grep -q "console=ttyS${i}" -end script - -script - # get console speed if provded with "console=ttySx,38400" - SPEED=\$(cat /proc/cmdline | sed -e"s/^.*console=ttyS${i}[,]*\([^ ]*\)[ ]*.*\$/\1/g") - # or use 9600 console speed as default - exec /sbin/getty -L \${SPEED:-9600} ttyS${i} -end script -EOF -done -' diff --git a/cloud-init-templates/cloud_config_centos.jinja2 b/cloud-init-templates/cloud_config_centos.jinja2 deleted file mode 100644 index 851d89f5..00000000 --- a/cloud-init-templates/cloud_config_centos.jinja2 +++ /dev/null @@ -1,106 +0,0 @@ -#cloud-config -resize_rootfs: false -growpart: - mode: false -disable_ec2_metadata: true -disable_root: false - -# password: RANDOM -# chpasswd: { expire: True } - -ssh_pwauth: false -ssh_authorized_keys: -{% for key in common.ssh_auth_keys %} - - {{ key }} -{% endfor %} - -# set the locale to a given locale -# default: en_US.UTF-8 -locale: en_US.UTF-8 - -timezone: {{ common.timezone }} - -hostname: {{ common.hostname }} -fqdn: {{ common.fqdn }} - -# add entries to rsyslog configuration -rsyslog: - - filename: 00-remote.conf - content: | - $template LogToMaster, "<%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n" - *.* @{{ common.master_ip }};LogToMaster - -runcmd: -{% if puppet.enable != 1 %} - - service puppet stop - - chkconfig puppet off -{% endif %} -{% if mcollective.enable != 1 %} - - service mcollective stop - - chkconfig mcollective off -{% else %} - - chkconfig mcollective on -{% endif %} - - iptables -t filter -F INPUT - - iptables -t filter -F FORWARD - - service iptables save - -# that module's missing in 0.6.3, but existent for >= 0.7.3 -write_files: - - content: | - --- - url: {{ common.master_url }} - path: /etc/nailgun-agent/config.yaml - - content: target - path: /etc/nailgun_systemtype - -mcollective: - conf: - main_collective: mcollective - collectives: mcollective - libdir: /usr/libexec/mcollective - logfile: /var/log/mcollective.log - loglevel: debug - daemonize: 1 - direct_addressing: 1 - ttl: 4294957 - securityprovider: psk - plugin.psk: {{ mcollective.pskey }} - identity: {{ mcollective.identity }} -{% if mcollective.connector == 'stomp' %} - connector = stomp - plugin.stomp.host: {{ mcollective.host }} - plugin.stomp.port: {{ mcollective.port|default(61613) }} - plugin.stomp.user: {{ mcollective.user }} - plugin.stomp.password: {{ mcollective.password }} -{% else %} - connector: rabbitmq - plugin.rabbitmq.vhost: {{ mcollective.vhost }} - plugin.rabbitmq.pool.size: 1 - plugin.rabbitmq.pool.1.host: {{ mcollective.host }} - plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }} - plugin.rabbitmq.pool.1.user: {{ mcollective.user }} - plugin.rabbitmq.pool.1.password: {{ mcollective.password }} - plugin.rabbitmq.heartbeat_interval: 30 -{% endif %} - factsource: yaml - plugin.yaml: /etc/mcollective/facts.yaml - -puppet: - conf: - main: - logdir: /var/log/puppet - rundir: /var/run/puppet - ssldir: $vardir/ssl - pluginsync: true - prerun_command: /bin/true - postrun_command: /bin/true - agent: - classfile: $vardir/classes.txt - localconfig: $vardir/localconfig - server: {{ puppet.master }} - report: false - configtimeout: 600 - - -final_message: "YAY! The system is finally up, after $UPTIME seconds" diff --git a/cloud-init-templates/cloud_config_fuel_6.1_ubuntu.jinja2 b/cloud-init-templates/cloud_config_fuel_6.1_ubuntu.jinja2 deleted file mode 100644 index 757c9592..00000000 --- a/cloud-init-templates/cloud_config_fuel_6.1_ubuntu.jinja2 +++ /dev/null @@ -1,105 +0,0 @@ -#cloud-config -resize_rootfs: false -growpart: - mode: false -disable_ec2_metadata: true -disable_root: false -user: root -password: r00tme -chpasswd: { expire: false } -ssh_pwauth: false -ssh_authorized_keys: -{% for key in common.ssh_auth_keys %} - - {{ key }} -{% endfor %} - -# set the locale to a given locale -# default: en_US.UTF-8 -locale: en_US.UTF-8 - -timezone: {{ common.timezone }} - -hostname: {{ common.hostname }} -fqdn: {{ common.fqdn }} - - -# add entries to rsyslog configuration -rsyslog: - - filename: 10-log2master.conf - content: | - $template LogToMaster, "<%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n" - *.* @{{ common.master_ip }};LogToMaster - - -# that module's missing in 0.6.3, but existent for >= 0.7.3 -write_files: - - content: | - --- - url: {{ common.master_url }} - path: /etc/nailgun-agent/config.yaml - - content: target - path: /etc/nailgun_systemtype - -mcollective: - conf: - main_collective: mcollective - collectives: mcollective - libdir: /usr/share/mcollective/plugins - logfile: /var/log/mcollective.log - loglevel: debug - daemonize: 0 - direct_addressing: 1 - ttl: 4294957 - securityprovider: psk - plugin.psk: {{ mcollective.pskey }} - identity: {{ mcollective.identity }} -{% if mcollective.connector == 'stomp' %} - connector = stomp - plugin.stomp.host: {{ mcollective.host }} - plugin.stomp.port: {{ mcollective.port|default(61613) }} - plugin.stomp.user: {{ mcollective.user }} - plugin.stomp.password: {{ mcollective.password }} -{% else %} - connector: rabbitmq - plugin.rabbitmq.vhost: {{ mcollective.vhost }} - plugin.rabbitmq.pool.size: 1 - plugin.rabbitmq.pool.1.host: {{ mcollective.host }} - plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }} - plugin.rabbitmq.pool.1.user: {{ mcollective.user }} - plugin.rabbitmq.pool.1.password: {{ mcollective.password }} - plugin.rabbitmq.heartbeat_interval: 30 -{% endif %} - factsource: yaml - plugin.yaml: /etc/mcollective/facts.yaml - -puppet: - conf: - main: - logdir: /var/log/puppet - rundir: /var/run/puppet - ssldir: $vardir/ssl - pluginsync: true - prerun_command: /bin/true - postrun_command: /bin/true - agent: - classfile: $vardir/classes.txt - localconfig: $vardir/localconfig - server: {{ puppet.master }} - report: false - configtimeout: 600 - -runcmd: -{% if puppet.enable != 1 %} - - /usr/sbin/invoke-rc.d puppet stop - - /usr/sbin/update-rc.d -f puppet remove -{% endif %} -{% if mcollective.enable != 1 %} - - /usr/sbin/invoke-rc.d mcollective stop - - echo manual > /etc/init/mcollective.override -{% else %} - - rm -f /etc/init/mcollective.override -{% endif %} - - iptables -t filter -F INPUT - - iptables -t filter -F FORWARD - -final_message: "YAY! The system is finally up, after $UPTIME seconds" diff --git a/cloud-init-templates/cloud_config_fuel_7.0_ubuntu.jinja2 b/cloud-init-templates/cloud_config_fuel_7.0_ubuntu.jinja2 deleted file mode 100644 index 757c9592..00000000 --- a/cloud-init-templates/cloud_config_fuel_7.0_ubuntu.jinja2 +++ /dev/null @@ -1,105 +0,0 @@ -#cloud-config -resize_rootfs: false -growpart: - mode: false -disable_ec2_metadata: true -disable_root: false -user: root -password: r00tme -chpasswd: { expire: false } -ssh_pwauth: false -ssh_authorized_keys: -{% for key in common.ssh_auth_keys %} - - {{ key }} -{% endfor %} - -# set the locale to a given locale -# default: en_US.UTF-8 -locale: en_US.UTF-8 - -timezone: {{ common.timezone }} - -hostname: {{ common.hostname }} -fqdn: {{ common.fqdn }} - - -# add entries to rsyslog configuration -rsyslog: - - filename: 10-log2master.conf - content: | - $template LogToMaster, "<%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n" - *.* @{{ common.master_ip }};LogToMaster - - -# that module's missing in 0.6.3, but existent for >= 0.7.3 -write_files: - - content: | - --- - url: {{ common.master_url }} - path: /etc/nailgun-agent/config.yaml - - content: target - path: /etc/nailgun_systemtype - -mcollective: - conf: - main_collective: mcollective - collectives: mcollective - libdir: /usr/share/mcollective/plugins - logfile: /var/log/mcollective.log - loglevel: debug - daemonize: 0 - direct_addressing: 1 - ttl: 4294957 - securityprovider: psk - plugin.psk: {{ mcollective.pskey }} - identity: {{ mcollective.identity }} -{% if mcollective.connector == 'stomp' %} - connector = stomp - plugin.stomp.host: {{ mcollective.host }} - plugin.stomp.port: {{ mcollective.port|default(61613) }} - plugin.stomp.user: {{ mcollective.user }} - plugin.stomp.password: {{ mcollective.password }} -{% else %} - connector: rabbitmq - plugin.rabbitmq.vhost: {{ mcollective.vhost }} - plugin.rabbitmq.pool.size: 1 - plugin.rabbitmq.pool.1.host: {{ mcollective.host }} - plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }} - plugin.rabbitmq.pool.1.user: {{ mcollective.user }} - plugin.rabbitmq.pool.1.password: {{ mcollective.password }} - plugin.rabbitmq.heartbeat_interval: 30 -{% endif %} - factsource: yaml - plugin.yaml: /etc/mcollective/facts.yaml - -puppet: - conf: - main: - logdir: /var/log/puppet - rundir: /var/run/puppet - ssldir: $vardir/ssl - pluginsync: true - prerun_command: /bin/true - postrun_command: /bin/true - agent: - classfile: $vardir/classes.txt - localconfig: $vardir/localconfig - server: {{ puppet.master }} - report: false - configtimeout: 600 - -runcmd: -{% if puppet.enable != 1 %} - - /usr/sbin/invoke-rc.d puppet stop - - /usr/sbin/update-rc.d -f puppet remove -{% endif %} -{% if mcollective.enable != 1 %} - - /usr/sbin/invoke-rc.d mcollective stop - - echo manual > /etc/init/mcollective.override -{% else %} - - rm -f /etc/init/mcollective.override -{% endif %} - - iptables -t filter -F INPUT - - iptables -t filter -F FORWARD - -final_message: "YAY! The system is finally up, after $UPTIME seconds" diff --git a/cloud-init-templates/cloud_config_fuel_8.0_ubuntu.jinja2 b/cloud-init-templates/cloud_config_fuel_8.0_ubuntu.jinja2 deleted file mode 100644 index 757c9592..00000000 --- a/cloud-init-templates/cloud_config_fuel_8.0_ubuntu.jinja2 +++ /dev/null @@ -1,105 +0,0 @@ -#cloud-config -resize_rootfs: false -growpart: - mode: false -disable_ec2_metadata: true -disable_root: false -user: root -password: r00tme -chpasswd: { expire: false } -ssh_pwauth: false -ssh_authorized_keys: -{% for key in common.ssh_auth_keys %} - - {{ key }} -{% endfor %} - -# set the locale to a given locale -# default: en_US.UTF-8 -locale: en_US.UTF-8 - -timezone: {{ common.timezone }} - -hostname: {{ common.hostname }} -fqdn: {{ common.fqdn }} - - -# add entries to rsyslog configuration -rsyslog: - - filename: 10-log2master.conf - content: | - $template LogToMaster, "<%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n" - *.* @{{ common.master_ip }};LogToMaster - - -# that module's missing in 0.6.3, but existent for >= 0.7.3 -write_files: - - content: | - --- - url: {{ common.master_url }} - path: /etc/nailgun-agent/config.yaml - - content: target - path: /etc/nailgun_systemtype - -mcollective: - conf: - main_collective: mcollective - collectives: mcollective - libdir: /usr/share/mcollective/plugins - logfile: /var/log/mcollective.log - loglevel: debug - daemonize: 0 - direct_addressing: 1 - ttl: 4294957 - securityprovider: psk - plugin.psk: {{ mcollective.pskey }} - identity: {{ mcollective.identity }} -{% if mcollective.connector == 'stomp' %} - connector = stomp - plugin.stomp.host: {{ mcollective.host }} - plugin.stomp.port: {{ mcollective.port|default(61613) }} - plugin.stomp.user: {{ mcollective.user }} - plugin.stomp.password: {{ mcollective.password }} -{% else %} - connector: rabbitmq - plugin.rabbitmq.vhost: {{ mcollective.vhost }} - plugin.rabbitmq.pool.size: 1 - plugin.rabbitmq.pool.1.host: {{ mcollective.host }} - plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }} - plugin.rabbitmq.pool.1.user: {{ mcollective.user }} - plugin.rabbitmq.pool.1.password: {{ mcollective.password }} - plugin.rabbitmq.heartbeat_interval: 30 -{% endif %} - factsource: yaml - plugin.yaml: /etc/mcollective/facts.yaml - -puppet: - conf: - main: - logdir: /var/log/puppet - rundir: /var/run/puppet - ssldir: $vardir/ssl - pluginsync: true - prerun_command: /bin/true - postrun_command: /bin/true - agent: - classfile: $vardir/classes.txt - localconfig: $vardir/localconfig - server: {{ puppet.master }} - report: false - configtimeout: 600 - -runcmd: -{% if puppet.enable != 1 %} - - /usr/sbin/invoke-rc.d puppet stop - - /usr/sbin/update-rc.d -f puppet remove -{% endif %} -{% if mcollective.enable != 1 %} - - /usr/sbin/invoke-rc.d mcollective stop - - echo manual > /etc/init/mcollective.override -{% else %} - - rm -f /etc/init/mcollective.override -{% endif %} - - iptables -t filter -F INPUT - - iptables -t filter -F FORWARD - -final_message: "YAY! The system is finally up, after $UPTIME seconds" diff --git a/cloud-init-templates/cloud_config_fuel_9.0_ubuntu.jinja2 b/cloud-init-templates/cloud_config_fuel_9.0_ubuntu.jinja2 deleted file mode 100644 index f1a91cc3..00000000 --- a/cloud-init-templates/cloud_config_fuel_9.0_ubuntu.jinja2 +++ /dev/null @@ -1,120 +0,0 @@ -#cloud-config -resize_rootfs: false -growpart: - mode: false -disable_ec2_metadata: true -disable_root: false -users: -{% for user in user_accounts %} - - name: {{ user.name }} - passwd: {{ user.hashed_password }} - lock_passwd: False - homedir: {{ user.homedir }} - shell: {{ user.shell }} - {% if user.ssh_keys|length > 0 %} - ssh_authorized_keys: - {% for key in user.ssh_keys %} - - {{ key }} - {% endfor %} - {% endif %} - {% if user.sudo|length > 0 %} - sudo: - {% for entry in user.sudo %} - - "{{ entry }}" - {% endfor %} - {% endif %} -{% endfor %} -chpasswd: { expire: false } -ssh_pwauth: false - -# set the locale to a given locale -# default: en_US.UTF-8 -locale: en_US.UTF-8 - -timezone: {{ common.timezone }} - -hostname: {{ common.hostname }} -fqdn: {{ common.fqdn }} - - -# add entries to rsyslog configuration -rsyslog: - - filename: 00-remote.conf - content: | - $template LogToMaster, "<%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n" - *.* @{{ common.master_ip }};LogToMaster - - -# that module's missing in 0.6.3, but existent for >= 0.7.3 -write_files: - - content: | - --- - url: {{ common.master_url }} - path: /etc/nailgun-agent/config.yaml - - content: target - path: /etc/nailgun_systemtype - -mcollective: - conf: - main_collective: mcollective - collectives: mcollective - libdir: /usr/share/mcollective/plugins - logfile: /var/log/mcollective.log - loglevel: debug - daemonize: 0 - direct_addressing: 1 - ttl: 4294957 - securityprovider: psk - plugin.psk: {{ mcollective.pskey }} - identity: {{ mcollective.identity }} -{% if mcollective.connector == 'stomp' %} - connector = stomp - plugin.stomp.host: {{ mcollective.host }} - plugin.stomp.port: {{ mcollective.port|default(61613) }} - plugin.stomp.user: {{ mcollective.user }} - plugin.stomp.password: {{ mcollective.password }} -{% else %} - connector: rabbitmq - plugin.rabbitmq.vhost: {{ mcollective.vhost }} - plugin.rabbitmq.pool.size: 1 - plugin.rabbitmq.pool.1.host: {{ mcollective.host }} - plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }} - plugin.rabbitmq.pool.1.user: {{ mcollective.user }} - plugin.rabbitmq.pool.1.password: {{ mcollective.password }} - plugin.rabbitmq.heartbeat_interval: 30 -{% endif %} - factsource: yaml - plugin.yaml: /etc/mcollective/facts.yaml - -puppet: - conf: - main: - logdir: /var/log/puppet - rundir: /var/run/puppet - ssldir: $vardir/ssl - pluginsync: true - prerun_command: /bin/true - postrun_command: /bin/true - stringify_facts: false - agent: - classfile: $vardir/classes.txt - localconfig: $vardir/localconfig - server: {{ puppet.master }} - report: false - configtimeout: 600 - -runcmd: -{% if puppet.enable != 1 %} - - /usr/sbin/invoke-rc.d puppet stop - - /usr/sbin/update-rc.d -f puppet remove -{% endif %} -{% if mcollective.enable != 1 %} - - /usr/sbin/invoke-rc.d mcollective stop - - echo manual > /etc/init/mcollective.override -{% else %} - - rm -f /etc/init/mcollective.override -{% endif %} - - iptables -t filter -F INPUT - - iptables -t filter -F FORWARD - -final_message: "YAY! The system is finally up, after $UPTIME seconds" \ No newline at end of file diff --git a/cloud-init-templates/cloud_config_ubuntu.jinja2 b/cloud-init-templates/cloud_config_ubuntu.jinja2 deleted file mode 100644 index c9d732e5..00000000 --- a/cloud-init-templates/cloud_config_ubuntu.jinja2 +++ /dev/null @@ -1,145 +0,0 @@ -#cloud-config -resize_rootfs: false -growpart: - mode: false -disable_ec2_metadata: true -disable_root: false -users: -{% for user in user_accounts %} - - name: {{ user.name }} - passwd: {{ user.hashed_password }} - lock_passwd: False - homedir: {{ user.homedir }} - shell: {{ user.shell }} - {% if user.ssh_keys|length > 0 %} - ssh_authorized_keys: - {% for key in user.ssh_keys %} - - {{ key }} - {% endfor %} - {% endif %} - {% if user.sudo|length > 0 %} - sudo: - {% for entry in user.sudo %} - - "{{ entry }}" - {% endfor %} - {% endif %} -{% endfor %} -chpasswd: { expire: false } -ssh_pwauth: false - -# set the locale to a given locale -# default: en_US.UTF-8 -locale: en_US.UTF-8 - -timezone: {{ common.timezone }} - -hostname: {{ common.hostname }} -fqdn: {{ common.fqdn }} - - -# add entries to rsyslog configuration -rsyslog: - - filename: 00-remote.conf - content: | - $template LogToMaster, "<%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n" - *.* @{{ common.master_ip }};LogToMaster - - -# that module's missing in 0.6.3, but existent for >= 0.7.3 -write_files: - - content: | - --- - url: {{ common.master_url }} - path: /etc/nailgun-agent/config.yaml - - content: target - path: /etc/nailgun_systemtype - -mcollective: - conf: - main_collective: mcollective - collectives: mcollective - libdir: /usr/share/mcollective/plugins - logfile: /var/log/mcollective.log - loglevel: debug - daemonize: 1 - direct_addressing: 1 - ttl: 4294957 - securityprovider: psk - plugin.psk: {{ mcollective.pskey }} - identity: {{ mcollective.identity }} -{% if mcollective.connector == 'stomp' %} - connector = stomp - plugin.stomp.host: {{ mcollective.host }} - plugin.stomp.port: {{ mcollective.port|default(61613) }} - plugin.stomp.user: {{ mcollective.user }} - plugin.stomp.password: {{ mcollective.password }} -{% else %} - connector: rabbitmq - plugin.rabbitmq.vhost: {{ mcollective.vhost }} - plugin.rabbitmq.pool.size: 1 - plugin.rabbitmq.pool.1.host: {{ mcollective.host }} - plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }} - plugin.rabbitmq.pool.1.user: {{ mcollective.user }} - plugin.rabbitmq.pool.1.password: {{ mcollective.password }} - plugin.rabbitmq.heartbeat_interval: 30 -{% endif %} - factsource: yaml - plugin.yaml: /etc/mcollective/facts.yaml - -puppet: - conf: - main: - logdir: /var/log/puppet - rundir: /var/run/puppet - ssldir: $vardir/ssl - pluginsync: true - prerun_command: /bin/true - postrun_command: /bin/true - stringify_facts: false - agent: - classfile: $vardir/classes.txt - localconfig: $vardir/localconfig - server: {{ puppet.master }} - report: false - configtimeout: 600 - -runcmd: -{% if puppet.enable != 1 %} - - if [ -x /bin/systemctl ]; then - - /bin/systemctl stop puppet - - /bin/systemctl disable puppet - - else - - /usr/sbin/invoke-rc.d puppet stop - - /usr/sbin/update-rc.d -f puppet remove - - echo manual > /etc/init/puppet.override - - fi -{% else %} - - if [ -x /bin/systemctl ]; then - - /bin/systemctl enable puppet - - else - - rm -f /etc/init/puppet.override - - fi -{% endif %} -{% if mcollective.enable != 1 %} - - if [ -x /bin/systemctl ]; then - - /bin/systemctl stop mcollective - - /bin/systemctl disable mcollective - - else - - /usr/sbin/invoke-rc.d mcollective stop - - /usr/sbin/update-rc.d -f mcollective remove - - echo manual > /etc/init/mcollective.override - - fi -{% else %} - - if [ -x /bin/systemctl ]; then - - /bin/systemctl enable mcollective -# TODO(dteselkin) rework start sequence when bug -# https://bugs.launchpad.net/fuel/+bug/1543063 is fixed - - /bin/systemctl start mcollective - - else - - rm -f /etc/init/mcollective.override - - fi -{% endif %} - - iptables -t filter -F INPUT - - iptables -t filter -F FORWARD - -final_message: "YAY! The system is finally up, after $UPTIME seconds" diff --git a/cloud-init-templates/meta_data_centos.jinja2 b/cloud-init-templates/meta_data_centos.jinja2 deleted file mode 100644 index f63a89bd..00000000 --- a/cloud-init-templates/meta_data_centos.jinja2 +++ /dev/null @@ -1,11 +0,0 @@ -# instance-id will be autogenerated -# instance-id: iid-abcdefg -#network-interfaces: | -# auto {{ common.admin_iface_name|default("eth0") }} -# iface {{ common.admin_iface_name|default("eth0") }} inet static -# address {{ common.admin_ip }} -# # network 192.168.1.0 -# netmask {{ common.admin_mask }} -# # broadcast 192.168.1.255 -# # gateway 192.168.1.254 -hostname: {{ common.hostname }} diff --git a/cloud-init-templates/meta_data_json.jinja2 b/cloud-init-templates/meta_data_json.jinja2 deleted file mode 100644 index 14e8a50f..00000000 --- a/cloud-init-templates/meta_data_json.jinja2 +++ /dev/null @@ -1,4 +0,0 @@ -{ - "hostname": "{{ common.hostname }}", - "uuid": "some-unused-id" -} diff --git a/cloud-init-templates/meta_data_ubuntu.jinja2 b/cloud-init-templates/meta_data_ubuntu.jinja2 deleted file mode 100644 index f63a89bd..00000000 --- a/cloud-init-templates/meta_data_ubuntu.jinja2 +++ /dev/null @@ -1,11 +0,0 @@ -# instance-id will be autogenerated -# instance-id: iid-abcdefg -#network-interfaces: | -# auto {{ common.admin_iface_name|default("eth0") }} -# iface {{ common.admin_iface_name|default("eth0") }} inet static -# address {{ common.admin_ip }} -# # network 192.168.1.0 -# netmask {{ common.admin_mask }} -# # broadcast 192.168.1.255 -# # gateway 192.168.1.254 -hostname: {{ common.hostname }} diff --git a/contrib/fuel_bootstrap/files/README.md b/contrib/fuel_bootstrap/files/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/files/trusty/etc/e2fsck.conf b/contrib/fuel_bootstrap/files/trusty/etc/e2fsck.conf deleted file mode 100644 index c85e219e..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/e2fsck.conf +++ /dev/null @@ -1,16 +0,0 @@ -[options] -broken_system_clock = true - -[problems] - -# Superblock last mount time is in the future (PR_0_FUTURE_SB_LAST_MOUNT). -0x000031 = { - preen_ok = true - preen_nomessage = true -} - -# Superblock last write time is in the future (PR_0_FUTURE_SB_LAST_WRITE). -0x000032 = { - preen_ok = true - preen_nomessage = true -} diff --git a/contrib/fuel_bootstrap/files/trusty/etc/hostname b/contrib/fuel_bootstrap/files/trusty/etc/hostname deleted file mode 100644 index b7c200ac..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/hostname +++ /dev/null @@ -1 +0,0 @@ -bootstrap diff --git a/contrib/fuel_bootstrap/files/trusty/etc/init/ttyS0.conf b/contrib/fuel_bootstrap/files/trusty/etc/init/ttyS0.conf deleted file mode 100644 index 718db01b..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/init/ttyS0.conf +++ /dev/null @@ -1,18 +0,0 @@ -# ttyS0 - getty - -start on stopped rc RUNLEVEL=[12345] -stop on runlevel [!12345] - -respawn - -pre-start script - # exit if console not present on ttyS0 - cat /proc/cmdline | grep -q "console=ttyS0" -end script - -script - # get console speed if provded with "console=ttySx,38400" - SPEED=$(cat /proc/cmdline | sed -e"s/^.*console=ttyS0[,]*\([^ ]*\)[ ]*.*$/\1/g") - # or use 9600 console speed as default - exec /sbin/getty -L ${SPEED:-9600} ttyS0 -end script diff --git a/contrib/fuel_bootstrap/files/trusty/etc/init/ttyS1.conf b/contrib/fuel_bootstrap/files/trusty/etc/init/ttyS1.conf deleted file mode 100644 index 5d954a4c..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/init/ttyS1.conf +++ /dev/null @@ -1,18 +0,0 @@ -# ttyS1 - getty - -start on stopped rc RUNLEVEL=[12345] -stop on runlevel [!12345] - -respawn - -pre-start script - # exit if console not present on ttyS1 - cat /proc/cmdline | grep -q "console=ttyS1" -end script - -script - # get console speed if provded with "console=ttySx,38400" - SPEED=$(cat /proc/cmdline | sed -e"s/^.*console=ttyS1[,]*\([^ ]*\)[ ]*.*$/\1/g") - # or use 9600 console speed as default - exec /sbin/getty -L ${SPEED:-9600} ttyS1 -end script diff --git a/contrib/fuel_bootstrap/files/trusty/etc/localtime b/contrib/fuel_bootstrap/files/trusty/etc/localtime deleted file mode 100644 index 5583f5b0c6e6949372648a7d75502e4d01b44931..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 118 mcmWHE%1kq2zyORu5fFv}5Ss /dev/null` 2> /dev/null || true - endscript -} diff --git a/contrib/fuel_bootstrap/files/trusty/etc/mcollective/server.cfg b/contrib/fuel_bootstrap/files/trusty/etc/mcollective/server.cfg deleted file mode 100644 index 75887d8b..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/mcollective/server.cfg +++ /dev/null @@ -1,27 +0,0 @@ -main_collective = mcollective -collectives = mcollective -libdir = /usr/share/mcollective/plugins -logfile = /var/log/mcollective.log -loglevel = debug -direct_addressing = 1 -daemonize = 0 - -# Set TTL to 1.5 hours -ttl = 5400 - -# Plugins -securityprovider = psk -plugin.psk = unset - -connector = rabbitmq -plugin.rabbitmq.vhost = mcollective -plugin.rabbitmq.pool.size = 1 -plugin.rabbitmq.pool.1.host = -plugin.rabbitmq.pool.1.port = 61613 -plugin.rabbitmq.pool.1.user = mcollective -plugin.rabbitmq.pool.1.password = marionette -plugin.rabbitmq.heartbeat_interval = 30 - -# Facts -factsource = yaml -plugin.yaml = /etc/mcollective/facts.yaml diff --git a/contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/blacklist-i2c-piix4.conf b/contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/blacklist-i2c-piix4.conf deleted file mode 100644 index a4339ccd..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/blacklist-i2c-piix4.conf +++ /dev/null @@ -1 +0,0 @@ -blacklist i2c_piix4 diff --git a/contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/mlnx4_core.conf b/contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/mlnx4_core.conf deleted file mode 100644 index 1b6f5af8..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/modprobe.d/mlnx4_core.conf +++ /dev/null @@ -1 +0,0 @@ -options mlx4_core port_type_array=2,2 diff --git a/contrib/fuel_bootstrap/files/trusty/etc/modules b/contrib/fuel_bootstrap/files/trusty/etc/modules deleted file mode 100644 index 1ae7bea0..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/modules +++ /dev/null @@ -1,8 +0,0 @@ -# /etc/modules: kernel modules to load at boot time. -# -# This file contains the names of kernel modules that should be loaded -# at boot time, one per line. Lines beginning with "#" are ignored. -# Parameters can be specified after the module name. - -# Enabling of VLAN support -8021q diff --git a/contrib/fuel_bootstrap/files/trusty/etc/nailgun_systemtype b/contrib/fuel_bootstrap/files/trusty/etc/nailgun_systemtype deleted file mode 100644 index b7c200ac..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/nailgun_systemtype +++ /dev/null @@ -1 +0,0 @@ -bootstrap diff --git a/contrib/fuel_bootstrap/files/trusty/etc/rc.local b/contrib/fuel_bootstrap/files/trusty/etc/rc.local deleted file mode 100755 index 81f17f6f..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/rc.local +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -e - -# Perform multipath reload -multipath-reload || true - -# Perform fuel bootstrap configuration -fix-configs-on-startup || true diff --git a/contrib/fuel_bootstrap/files/trusty/etc/rsyslog.d/50-default-template.conf b/contrib/fuel_bootstrap/files/trusty/etc/rsyslog.d/50-default-template.conf deleted file mode 100644 index 4511fef0..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/rsyslog.d/50-default-template.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Log all messages with this template -$template CustomLog, "%$NOW%T%TIMESTAMP:8:$%Z %syslogseverity-text% %syslogtag% %msg%\n" - -$ActionFileDefaultTemplate CustomLog - -user.debug /var/log/messages \ No newline at end of file diff --git a/contrib/fuel_bootstrap/files/trusty/etc/send2syslog.conf b/contrib/fuel_bootstrap/files/trusty/etc/send2syslog.conf deleted file mode 100644 index 84a3df9b..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/send2syslog.conf +++ /dev/null @@ -1,22 +0,0 @@ -{ -"watchlist": [ - {"servers": [ {"host": "@MASTER_NODE_IP@"} ], - "watchfiles": [ - {"tag": "bootstrap/dmesg", "files": ["/var/log/dmesg"]}, - {"tag": "bootstrap/secure", "files": ["/var/log/secure"]}, - {"tag": "bootstrap/messages", "files": ["/var/log/messages"]}, - {"tag": "bootstrap/fuel-agent", "files": ["/var/log/fuel-agent.log"]}, - {"tag": "bootstrap/syslog", "files": ["/var/log/syslog"]}, - {"tag": "bootstrap/auth", "files": ["/var/log/auth.log"]}, - {"tag": "bootstrap/mcollective", "log_type": "ruby", - "files": ["/var/log/mcollective.log"]}, - {"tag": "bootstrap/agent", "log_type": "ruby", - "files": ["/var/log/nailgun-agent.log"]}, - {"tag": "bootstrap/netprobe_sender", "log_type": "netprobe", - "files": ["/var/log/netprobe_sender.log"]}, - {"tag": "bootstrap/netprobe_listener", "log_type": "netprobe", - "files": ["/var/log/netprobe_listener.log"]} - ] - } -] -} diff --git a/contrib/fuel_bootstrap/files/trusty/etc/ssh/sshd_config b/contrib/fuel_bootstrap/files/trusty/etc/ssh/sshd_config deleted file mode 100644 index 393fd26b..00000000 --- a/contrib/fuel_bootstrap/files/trusty/etc/ssh/sshd_config +++ /dev/null @@ -1,20 +0,0 @@ -Protocol 2 -SyslogFacility AUTHPRIV -PasswordAuthentication no -PubkeyAuthentication yes -ChallengeResponseAuthentication no -GSSAPIAuthentication no -UsePAM no -UseDNS no - -# Accept locale-related environment variables -AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES -AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT -AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE -AcceptEnv XMODIFIERS - -Subsystem sftp /usr/lib/openssh/sftp-server - -# Secure Ciphers and MACs -Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128 -MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,hmac-sha1 diff --git a/contrib/fuel_bootstrap/files/trusty/lib/udev/rules.d/80-net-name-slot.rules b/contrib/fuel_bootstrap/files/trusty/lib/udev/rules.d/80-net-name-slot.rules deleted file mode 100755 index b4f2ccab..00000000 --- a/contrib/fuel_bootstrap/files/trusty/lib/udev/rules.d/80-net-name-slot.rules +++ /dev/null @@ -1,20 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="net_name_slot_end" -SUBSYSTEM!="net", GOTO="net_name_slot_end" -NAME!="", GOTO="net_name_slot_end" - -IMPORT{cmdline}="net.ifnames" -ENV{net.ifnames}=="0", GOTO="net_name_slot_end" - -# Workaround for resolving too long ID_NET_NAME_ONBOARD issue on VMware ( #LP1543378) -ENV{ID_NET_NAME_ONBOARD}=="eno????????*", GOTO="net_name_onboard_end" -NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}" -LABEL="net_name_onboard_end" - -NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}" -NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}" - -ENV{DEVTYPE}=="fcoe", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}" - -LABEL="net_name_slot_end" diff --git a/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup b/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup deleted file mode 100755 index a086a9b1..00000000 --- a/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -set -e - -masternode_ip=$(sed -rn 's/^.*url=http:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/ p' /proc/cmdline) -mco_user=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_user | awk -F\= '{print $2}') -mco_pass=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_pass | awk -F\= '{print $2}') -[ -z "$mco_user" ] && mco_user="mcollective" -[ -z "$mco_pass" ] && mco_pass="marionette" - -# Send logs to master node. -cat > /etc/send2syslog.conf < /var/lib/ntp/ntp.drift -chown ntp: /var/lib/ntp/ntp.drift - -# Sync clock with master node -# -sed -i "/^\s*server\b/ d" /etc/ntp.conf -echo "server $masternode_ip burst iburst" >> /etc/ntp.conf -service ntp restart - -# -# Update mcollective config -# -sed -i "s/^plugin.rabbitmq.pool.1.host\b.*$/plugin.rabbitmq.pool.1.host = $masternode_ip/" /etc/mcollective/server.cfg -sed -i "s/^plugin.rabbitmq.pool.1.user\b.*$/plugin.rabbitmq.pool.1.user = $mco_user/" /etc/mcollective/server.cfg -sed -i "s/^plugin.rabbitmq.pool.1.password\b.*$/plugin.rabbitmq.pool.1.password= $mco_pass/" /etc/mcollective/server.cfg -service mcollective restart diff --git a/contrib/fuel_bootstrap/files/trusty/usr/bin/multipath-reload b/contrib/fuel_bootstrap/files/trusty/usr/bin/multipath-reload deleted file mode 100755 index f78b68f5..00000000 --- a/contrib/fuel_bootstrap/files/trusty/usr/bin/multipath-reload +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -x - -LOG_NAME='multipath-reload' -TIMEOUT='360' -KILL_TIMEOUT='120' -SETTLE_ATTEMPTS='10' - -wait_for_udev_settle() { -# See more info in https://review.openstack.org/#/c/285340/ - for i in `seq 1 ${SETTLE_ATTEMPTS}`; do - udevadm settle --timeout=${TIMEOUT} - sleep 0.1 - done -} - -m_reload() { -# See more info in https://review.openstack.org/#/c/294430/ - echo "`date '+%Y-%m-%d-%H-%M-%S'`: Perform multipath reloading" - timeout --kill-after=${KILL_TIMEOUT} ${TIMEOUT} dmsetup remove_all - timeout --kill-after=${KILL_TIMEOUT} ${TIMEOUT} dmsetup udevcomplete_all -y - timeout --kill-after=${KILL_TIMEOUT} ${TIMEOUT} multipath -F - timeout --kill-after=${KILL_TIMEOUT} ${TIMEOUT} multipath -r - timeout --kill-after=${KILL_TIMEOUT} ${TIMEOUT} udevadm trigger --subsystem-match=block - wait_for_udev_settle - echo "`date '+%Y-%m-%d-%H-%M-%S'`: Multipath reloading is done" -} - -m_reload 2>&1 | tee -a /var/log/${LOG_NAME} | /usr/bin/logger -i -t ${LOG_NAME} diff --git a/contrib/fuel_bootstrap/files/trusty/usr/bin/send2syslog.py b/contrib/fuel_bootstrap/files/trusty/usr/bin/send2syslog.py deleted file mode 100755 index 6f9d404f..00000000 --- a/contrib/fuel_bootstrap/files/trusty/usr/bin/send2syslog.py +++ /dev/null @@ -1,505 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2013 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import json -import logging -from logging.handlers import SysLogHandler -from optparse import OptionParser -import os -import re -import signal -import sys -import time - - -# Add syslog levels to logging module. -logging.NOTICE = 25 -logging.ALERT = 60 -logging.EMERG = 70 -logging.addLevelName(logging.NOTICE, 'NOTICE') -logging.addLevelName(logging.ALERT, 'ALERT') -logging.addLevelName(logging.EMERG, 'EMERG') -SysLogHandler.priority_map['NOTICE'] = 'notice' -SysLogHandler.priority_map['ALERT'] = 'alert' -SysLogHandler.priority_map['EMERG'] = 'emerg' -# Define data and message format according to RFC 5424. -rfc5424_format = '{version} {timestamp} {hostname} {appname} {procid}'\ - ' {msgid} {structured_data} {msg}' -date_format = '%Y-%m-%dT%H:%M:%SZ' -# Define global semaphore. -sending_in_progress = 0 -# Define file types. -msg_levels = {'ruby': {'regex': '(?P[DIWEF]), \[[0-9-]{10}T', - 'levels': {'D': logging.DEBUG, - 'I': logging.INFO, - 'W': logging.WARNING, - 'E': logging.ERROR, - 'F': logging.FATAL - } - }, - 'syslog': {'regex': ('[0-9-]{10}T[0-9:]{8}Z (?P' - 'debug|info|notice|warning|err|crit|' - 'alert|emerg)'), - 'levels': {'debug': logging.DEBUG, - 'info': logging.INFO, - 'notice': logging.NOTICE, - 'warning': logging.WARNING, - 'err': logging.ERROR, - 'crit': logging.CRITICAL, - 'alert': logging.ALERT, - 'emerg': logging.EMERG - } - }, - 'anaconda': {'regex': ('[0-9:]{8},[0-9]+ (?P' - 'DEBUG|INFO|WARNING|ERROR|CRITICAL)'), - 'levels': {'DEBUG': logging.DEBUG, - 'INFO': logging.INFO, - 'WARNING': logging.WARNING, - 'ERROR': logging.ERROR, - 'CRITICAL': logging.CRITICAL - } - }, - 'netprobe': {'regex': ('[0-9-]{10} [0-9:]{8},[0-9]+ (?P' - 'DEBUG|INFO|WARNING|ERROR|CRITICAL)'), - 'levels': {'DEBUG': logging.DEBUG, - 'INFO': logging.INFO, - 'WARNING': logging.WARNING, - 'ERROR': logging.ERROR, - 'CRITICAL': logging.CRITICAL - } - } - - } -relevel_errors = { - 'anaconda': [ - { - 'regex': 'Error downloading \ -http://.*/images/(product|updates).img: HTTP response code said error', - 'levelfrom': logging.ERROR, - 'levelto': logging.WARNING - }, - { - 'regex': 'got to setupCdrom without a CD device', - 'levelfrom': logging.ERROR, - 'levelto': logging.WARNING - } - ] -} -# Create a main logger. -logging.basicConfig(format='%(levelname)s: %(message)s') -main_logger = logging.getLogger() -main_logger.setLevel(logging.NOTSET) - - -class WatchedFile: - """WatchedFile(filename) => Object that read lines from file if exist.""" - - def __init__(self, name): - self.name = name - self.fo = None - self.where = 0 - - def reset(self): - if self.fo: - self.fo.close() - self.fo = None - self.where = 0 - - def _checkRewrite(self): - try: - if os.stat(self.name)[6] < self.where: - self.reset() - except OSError: - self.close() - - def readLines(self): - """Return list of last append lines from file if exist.""" - - self._checkRewrite() - if not self.fo: - try: - self.fo = open(self.name, 'r') - except IOError: - return () - lines = self.fo.readlines() - self.where = self.fo.tell() - return lines - - def close(self): - self.reset() - - -class WatchedGroup: - """Can send data from group of specified files to specified servers.""" - - def __init__(self, servers, files, name): - self.servers = servers - self.files = files - self.log_type = files.get('log_type', 'syslog') - self.name = name - self._createLogger() - - def _createLogger(self): - self.watchedfiles = [] - logger = logging.getLogger(self.name) - logger.setLevel(logging.NOTSET) - logger.propagate = False - # Create log formatter. - format_dict = {'version': '1', - 'timestamp': '%(asctime)s', - 'hostname': config['hostname'], - 'appname': self.files['tag'], - 'procid': '-', - 'msgid': '-', - 'structured_data': '-', - 'msg': '%(message)s' - } - log_format = rfc5424_format.format(**format_dict) - formatter = logging.Formatter(log_format, date_format) - # Add log handler for each server. - for server in self.servers: - port = 'port' in server and server['port'] or 514 - syslog = SysLogHandler((server["host"], port)) - syslog.setFormatter(formatter) - logger.addHandler(syslog) - self.logger = logger - # Create WatchedFile objects from list of files. - for name in self.files['files']: - self.watchedfiles.append(WatchedFile(name)) - - def send(self): - """Send append data from files to servers.""" - - for watchedfile in self.watchedfiles: - for line in watchedfile.readLines(): - line = line.strip() - level = self._get_msg_level(line, self.log_type) - # Get rid of duplicated information in anaconda logs - line = re.sub( - msg_levels[self.log_type]['regex'] + "\s*:?\s?", - "", - line - ) - # Ignore meaningless errors - try: - for r in relevel_errors[self.log_type]: - if level == r['levelfrom'] and \ - re.match(r['regex'], line): - level = r['levelto'] - except KeyError: - pass - self.logger.log(level, line) - main_logger and main_logger.log( - level, - 'From file "%s" send: %s' % (watchedfile.name, line) - ) - - @staticmethod - def _get_msg_level(line, log_type): - if log_type in msg_levels: - msg_type = msg_levels[log_type] - regex = re.match(msg_type['regex'], line) - if regex: - return msg_type['levels'][regex.group('level')] - return logging.INFO - - -def sig_handler(signum, frame): - """Send all new data when signal arrived.""" - - if not sending_in_progress: - send_all() - exit(signum) - else: - config['run_once'] = True - - -def send_all(): - """Send any updates.""" - - for group in watchlist: - group.send() - - -def main_loop(): - """Periodicaly call sendlogs() for each group in watchlist.""" - - signal.signal(signal.SIGINT, sig_handler) - signal.signal(signal.SIGTERM, sig_handler) - while watchlist: - time.sleep(0.5) - send_all() - # If asked to run_once, exit now - if config['run_once']: - break - - -class Config: - """Collection of config generation methods. - Usage: config = Config.getConfig() - """ - - @classmethod - def getConfig(cls): - """Generate config from command line arguments and config file.""" - - # example_config = { - # "daemon": True, - # "run_once": False, - # "debug": False, - # "watchlist": [ - # {"servers": [ {"host": "localhost", "port": 514} ], - # "watchfiles": [ - # {"tag": "anaconda", - # "log_type": "anaconda", - # "files": ["/tmp/anaconda.log", - # "/mnt/sysimage/root/install.log"] - # } - # ] - # } - # ] - # } - - default_config = {"daemon": True, - "run_once": False, - "debug": False, - "hostname": cls._getHostname(), - "watchlist": [] - } - # First use default config as running config. - config = dict(default_config) - # Get command line options and validate it. - cmdline = cls.cmdlineParse()[0] - # Check config file source and read it. - if cmdline.config_file or cmdline.stdin_config: - try: - if cmdline.stdin_config is True: - fo = sys.stdin - else: - fo = open(cmdline.config_file, 'r') - parsed_config = json.load(fo) - if cmdline.debug: - print(parsed_config) - except IOError: # Raised if IO operations failed. - main_logger.error("Can not read config file %s\n" % - cmdline.config_file) - exit(1) - except ValueError as e: # Raised if json parsing failed. - main_logger.error("Can not parse config file. %s\n" % - e.message) - exit(1) - # Validate config from config file. - cls.configValidate(parsed_config) - # Copy gathered config from config file to running config - # structure. - for key, value in parsed_config.items(): - config[key] = value - else: - # If no config file specified use watchlist setting from - # command line. - watchlist = {"servers": [{"host": cmdline.host, - "port": cmdline.port}], - "watchfiles": [{"tag": cmdline.tag, - "log_type": cmdline.log_type, - "files": cmdline.watchfiles}]} - config['watchlist'].append(watchlist) - - # Apply behavioural command line options to running config. - if cmdline.no_daemon: - config["daemon"] = False - if cmdline.run_once: - config["run_once"] = True - if cmdline.debug: - config["debug"] = True - return config - - @staticmethod - def _getHostname(): - """Generate hostname by BOOTIF kernel option or use os.uname().""" - - with open('/proc/cmdline') as fo: - cpu_cmdline = fo.readline().strip() - regex = re.search('(?<=BOOTIF=)([0-9a-fA-F-]*)', cpu_cmdline) - if regex: - mac = regex.group(0).upper() - return ''.join(mac.split('-')) - return os.uname()[1] - - @staticmethod - def cmdlineParse(): - """Parse command line config options.""" - - parser = OptionParser() - parser.add_option("-c", "--config", dest="config_file", metavar="FILE", - help="Read config from FILE.") - parser.add_option("-i", "--stdin", dest="stdin_config", default=False, - action="store_true", help="Read config from Stdin.") - # FIXIT Add optionGroups. - parser.add_option("-r", "--run-once", dest="run_once", - action="store_true", help="Send all data and exit.") - parser.add_option("-n", "--no-daemon", dest="no_daemon", - action="store_true", help="Do not daemonize.") - parser.add_option("-d", "--debug", dest="debug", - action="store_true", help="Print debug messages.") - - parser.add_option("-t", "--tag", dest="tag", metavar="TAG", - help="Set tag of sending messages as TAG.") - parser.add_option("-T", "--type", dest="log_type", metavar="TYPE", - default='syslog', - help="Set type of files as TYPE" - "(default: %default).") - parser.add_option("-f", "--watchfile", dest="watchfiles", - action="append", - metavar="FILE", help="Add FILE to watchlist.") - parser.add_option("-s", "--host", dest="host", metavar="HOSTNAME", - help="Set destination as HOSTNAME.") - parser.add_option("-p", "--port", dest="port", type="int", default=514, - metavar="PORT", - help="Set remote port as PORT (default: %default).") - - options, args = parser.parse_args() - # Validate gathered options. - if options.config_file and options.stdin_config: - parser.error("You must not set both options --config" - " and --stdin at the same time.") - exit(1) - if ((options.config_file or options.stdin_config) and - (options.tag or options.watchfiles or options.host)): - main_logger.warning("If --config or --stdin is set up options" - " --tag, --watchfile, --type," - " --host and --port will be ignored.") - if (not (options.config_file or options.stdin_config) and - not (options.tag and options.watchfiles and options.host)): - parser.error("Options --tag, --watchfile and --host" - " must be set up at the same time.") - exit(1) - return options, args - - @staticmethod - def _checkType(value, value_type, value_name='', msg=None): - """Check correctness of type of value and exit if not.""" - - if not isinstance(value, value_type): - message = msg or "Value %r in config have type %r but"\ - " %r is expected." %\ - (value_name, type(value).__name__, value_type.__name__) - main_logger.error(message) - exit(1) - - @classmethod - def configValidate(cls, config): - """Validate types and names of data items in config.""" - - cls._checkType(config, dict, msg='Config must be a dict.') - for key in ("daemon", "run_once", "debug"): - if key in config: - cls._checkType(config[key], bool, key) - key = "hostname" - if key in config: - cls._checkType(config[key], basestring, key) - - key = "watchlist" - if key in config: - cls._checkType(config[key], list, key) - else: - main_logger.error("There must be key %r in config." % key) - exit(1) - - for item in config["watchlist"]: - cls._checkType(item, dict, "watchlist[n]") - key, name = "servers", "watchlist[n] => servers" - if key in item: - cls._checkType(item[key], list, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, '"watchlist[n]" item')) - exit(1) - key, name = "watchfiles", "watchlist[n] => watchfiles" - if key in item: - cls._checkType(item[key], list, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, '"watchlist[n]" item')) - exit(1) - - for item2 in item["servers"]: - cls._checkType(item2, dict, "watchlist[n] => servers[n]") - key, name = "host", "watchlist[n] => servers[n] => host" - if key in item2: - cls._checkType(item2[key], basestring, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, - '"watchlist[n] => servers[n]" item')) - exit(1) - key, name = "port", "watchlist[n] => servers[n] => port" - if key in item2: - cls._checkType(item2[key], int, name) - - for item2 in item["watchfiles"]: - cls._checkType(item2, dict, "watchlist[n] => watchfiles[n]") - key, name = "tag", "watchlist[n] => watchfiles[n] => tag" - if key in item2: - cls._checkType(item2[key], basestring, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, - '"watchlist[n] => watchfiles[n]" item')) - exit(1) - key = "log_type" - name = "watchlist[n] => watchfiles[n] => log_type" - if key in item2: - cls._checkType(item2[key], basestring, name) - key, name = "files", "watchlist[n] => watchfiles[n] => files" - if key in item2: - cls._checkType(item2[key], list, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, - '"watchlist[n] => watchfiles[n]" item')) - exit(1) - for item3 in item2["files"]: - name = "watchlist[n] => watchfiles[n] => files[n]" - cls._checkType(item3, basestring, name) - - -# Create global config. -config = Config.getConfig() -# Create list of WatchedGroup objects with different log names. -watchlist = [] -i = 0 -for item in config["watchlist"]: - for files in item['watchfiles']: - watchlist.append(WatchedGroup(item['servers'], files, str(i))) - i = i + 1 - -# Fork and loop -if config["daemon"]: - if not os.fork(): - # Redirect the standard I/O file descriptors to the specified file. - main_logger = None - DEVNULL = getattr(os, "devnull", "/dev/null") - os.open(DEVNULL, os.O_RDWR) # standard input (0) - os.dup2(0, 1) # Duplicate standard input to standard output (1) - os.dup2(0, 2) # Duplicate standard input to standard error (2) - - main_loop() - sys.exit(1) - sys.exit(0) -else: - if not config['debug']: - main_logger = None - main_loop() diff --git a/contrib/fuel_bootstrap/files/trusty/usr/share/initramfs-tools/hooks/netifnames b/contrib/fuel_bootstrap/files/trusty/usr/share/initramfs-tools/hooks/netifnames deleted file mode 100755 index d2421583..00000000 --- a/contrib/fuel_bootstrap/files/trusty/usr/share/initramfs-tools/hooks/netifnames +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -e - -PREREQS="udev" - -prereqs() { echo "$PREREQS"; } - -case "$1" in - prereqs) - prereqs - exit 0 - ;; -esac - -. /usr/share/initramfs-tools/hook-functions - -RULES=80-net-name-slot.rules -if [ -e /etc/udev/rules.d/$RULES ]; then - cp -p /etc/udev/rules.d/$RULES $DESTDIR/lib/udev/rules.d/ -elif [ -e /lib/udev/rules.d/$RULES ]; then - cp -p /lib/udev/rules.d/$RULES $DESTDIR/lib/udev/rules.d/ -fi diff --git a/contrib/fuel_bootstrap/files/xenial/etc/e2fsck.conf b/contrib/fuel_bootstrap/files/xenial/etc/e2fsck.conf deleted file mode 100644 index c85e219e..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/e2fsck.conf +++ /dev/null @@ -1,16 +0,0 @@ -[options] -broken_system_clock = true - -[problems] - -# Superblock last mount time is in the future (PR_0_FUTURE_SB_LAST_MOUNT). -0x000031 = { - preen_ok = true - preen_nomessage = true -} - -# Superblock last write time is in the future (PR_0_FUTURE_SB_LAST_WRITE). -0x000032 = { - preen_ok = true - preen_nomessage = true -} diff --git a/contrib/fuel_bootstrap/files/xenial/etc/hostname b/contrib/fuel_bootstrap/files/xenial/etc/hostname deleted file mode 100644 index b7c200ac..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/hostname +++ /dev/null @@ -1 +0,0 @@ -bootstrap diff --git a/contrib/fuel_bootstrap/files/xenial/etc/localtime b/contrib/fuel_bootstrap/files/xenial/etc/localtime deleted file mode 100644 index 5583f5b0c6e6949372648a7d75502e4d01b44931..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 118 mcmWHE%1kq2zyORu5fFv}5Ss /dev/null` 2> /dev/null || true - endscript -} diff --git a/contrib/fuel_bootstrap/files/xenial/etc/mcollective/server.cfg b/contrib/fuel_bootstrap/files/xenial/etc/mcollective/server.cfg deleted file mode 100644 index 54942518..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/mcollective/server.cfg +++ /dev/null @@ -1,27 +0,0 @@ -main_collective = mcollective -collectives = mcollective -libdir = /usr/share/mcollective/plugins -logfile = /var/log/mcollective.log -loglevel = debug -direct_addressing = 1 -daemonize = 1 - -# Set TTL to 1.5 hours -ttl = 5400 - -# Plugins -securityprovider = psk -plugin.psk = unset - -connector = rabbitmq -plugin.rabbitmq.vhost = mcollective -plugin.rabbitmq.pool.size = 1 -plugin.rabbitmq.pool.1.host = -plugin.rabbitmq.pool.1.port = 61613 -plugin.rabbitmq.pool.1.user = mcollective -plugin.rabbitmq.pool.1.password = marionette -plugin.rabbitmq.heartbeat_interval = 30 - -# Facts -factsource = yaml -plugin.yaml = /etc/mcollective/facts.yaml diff --git a/contrib/fuel_bootstrap/files/xenial/etc/modules b/contrib/fuel_bootstrap/files/xenial/etc/modules deleted file mode 100644 index 1ae7bea0..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/modules +++ /dev/null @@ -1,8 +0,0 @@ -# /etc/modules: kernel modules to load at boot time. -# -# This file contains the names of kernel modules that should be loaded -# at boot time, one per line. Lines beginning with "#" are ignored. -# Parameters can be specified after the module name. - -# Enabling of VLAN support -8021q diff --git a/contrib/fuel_bootstrap/files/xenial/etc/nailgun_systemtype b/contrib/fuel_bootstrap/files/xenial/etc/nailgun_systemtype deleted file mode 100644 index b7c200ac..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/nailgun_systemtype +++ /dev/null @@ -1 +0,0 @@ -bootstrap diff --git a/contrib/fuel_bootstrap/files/xenial/etc/rc.local b/contrib/fuel_bootstrap/files/xenial/etc/rc.local deleted file mode 100755 index 9712ba74..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/rc.local +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e - -# Perform fuel bootstrap configuration -/usr/bin/fix-configs-on-startup || /bin/true diff --git a/contrib/fuel_bootstrap/files/xenial/etc/rsyslog.d/50-default-template.conf b/contrib/fuel_bootstrap/files/xenial/etc/rsyslog.d/50-default-template.conf deleted file mode 100644 index 4511fef0..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/rsyslog.d/50-default-template.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Log all messages with this template -$template CustomLog, "%$NOW%T%TIMESTAMP:8:$%Z %syslogseverity-text% %syslogtag% %msg%\n" - -$ActionFileDefaultTemplate CustomLog - -user.debug /var/log/messages \ No newline at end of file diff --git a/contrib/fuel_bootstrap/files/xenial/etc/send2syslog.conf b/contrib/fuel_bootstrap/files/xenial/etc/send2syslog.conf deleted file mode 100644 index 84a3df9b..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/send2syslog.conf +++ /dev/null @@ -1,22 +0,0 @@ -{ -"watchlist": [ - {"servers": [ {"host": "@MASTER_NODE_IP@"} ], - "watchfiles": [ - {"tag": "bootstrap/dmesg", "files": ["/var/log/dmesg"]}, - {"tag": "bootstrap/secure", "files": ["/var/log/secure"]}, - {"tag": "bootstrap/messages", "files": ["/var/log/messages"]}, - {"tag": "bootstrap/fuel-agent", "files": ["/var/log/fuel-agent.log"]}, - {"tag": "bootstrap/syslog", "files": ["/var/log/syslog"]}, - {"tag": "bootstrap/auth", "files": ["/var/log/auth.log"]}, - {"tag": "bootstrap/mcollective", "log_type": "ruby", - "files": ["/var/log/mcollective.log"]}, - {"tag": "bootstrap/agent", "log_type": "ruby", - "files": ["/var/log/nailgun-agent.log"]}, - {"tag": "bootstrap/netprobe_sender", "log_type": "netprobe", - "files": ["/var/log/netprobe_sender.log"]}, - {"tag": "bootstrap/netprobe_listener", "log_type": "netprobe", - "files": ["/var/log/netprobe_listener.log"]} - ] - } -] -} diff --git a/contrib/fuel_bootstrap/files/xenial/etc/ssh/sshd_config b/contrib/fuel_bootstrap/files/xenial/etc/ssh/sshd_config deleted file mode 100644 index 393fd26b..00000000 --- a/contrib/fuel_bootstrap/files/xenial/etc/ssh/sshd_config +++ /dev/null @@ -1,20 +0,0 @@ -Protocol 2 -SyslogFacility AUTHPRIV -PasswordAuthentication no -PubkeyAuthentication yes -ChallengeResponseAuthentication no -GSSAPIAuthentication no -UsePAM no -UseDNS no - -# Accept locale-related environment variables -AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES -AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT -AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE -AcceptEnv XMODIFIERS - -Subsystem sftp /usr/lib/openssh/sftp-server - -# Secure Ciphers and MACs -Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128 -MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,hmac-sha1 diff --git a/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup b/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup deleted file mode 100755 index dee5b786..00000000 --- a/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -set -e - -export PATH=$PATH:/bin - -masternode_ip=$(sed -rn 's/^.*url=http:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/ p' /proc/cmdline) -mco_user=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_user | awk -F\= '{print $2}') -mco_pass=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_pass | awk -F\= '{print $2}') -[ -z "$mco_user" ] && mco_user="mcollective" -[ -z "$mco_pass" ] && mco_pass="marionette" - -# Send logs to master node. -cat > /etc/send2syslog.conf < /var/lib/ntp/ntp.drift -chown ntp: /var/lib/ntp/ntp.drift - -# Sync clock with master node -# -sed -i "/^\s*server\b/ d" /etc/ntp.conf -echo "server $masternode_ip burst iburst" >> /etc/ntp.conf -systemctl restart ntp - -sync_identity() { - while true - do - if new_identity=$(grep -s --line-regexp "[[:digit:]]\+" /etc/nailgun_uid) - then - if [ "$new_identity" != "$identity" ] - then - identity=$new_identity - sed -i '/^identity =/d' /etc/mcollective/server.cfg > /dev/null 2>&1 - echo "identity = $identity" >> /etc/mcollective/server.cfg - service mcollective restart - fi - fi - sleep 5 - done -} - -# -# Update mcollective config -# -sed -i "s/^plugin.rabbitmq.pool.1.host\b.*$/plugin.rabbitmq.pool.1.host = $masternode_ip/" /etc/mcollective/server.cfg -sed -i "s/^plugin.rabbitmq.pool.1.user\b.*$/plugin.rabbitmq.pool.1.user = $mco_user/" /etc/mcollective/server.cfg -sed -i "s/^plugin.rabbitmq.pool.1.password\b.*$/plugin.rabbitmq.pool.1.password= $mco_pass/" /etc/mcollective/server.cfg -sync_identity & - -# starting distributed serialization worker -/usr/bin/dask-worker --nprocs=`nproc` --nthreads 1 @MASTER_NODE_IP@:8002 diff --git a/contrib/fuel_bootstrap/files/xenial/usr/bin/send2syslog.py b/contrib/fuel_bootstrap/files/xenial/usr/bin/send2syslog.py deleted file mode 100755 index 6f9d404f..00000000 --- a/contrib/fuel_bootstrap/files/xenial/usr/bin/send2syslog.py +++ /dev/null @@ -1,505 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2013 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import json -import logging -from logging.handlers import SysLogHandler -from optparse import OptionParser -import os -import re -import signal -import sys -import time - - -# Add syslog levels to logging module. -logging.NOTICE = 25 -logging.ALERT = 60 -logging.EMERG = 70 -logging.addLevelName(logging.NOTICE, 'NOTICE') -logging.addLevelName(logging.ALERT, 'ALERT') -logging.addLevelName(logging.EMERG, 'EMERG') -SysLogHandler.priority_map['NOTICE'] = 'notice' -SysLogHandler.priority_map['ALERT'] = 'alert' -SysLogHandler.priority_map['EMERG'] = 'emerg' -# Define data and message format according to RFC 5424. -rfc5424_format = '{version} {timestamp} {hostname} {appname} {procid}'\ - ' {msgid} {structured_data} {msg}' -date_format = '%Y-%m-%dT%H:%M:%SZ' -# Define global semaphore. -sending_in_progress = 0 -# Define file types. -msg_levels = {'ruby': {'regex': '(?P[DIWEF]), \[[0-9-]{10}T', - 'levels': {'D': logging.DEBUG, - 'I': logging.INFO, - 'W': logging.WARNING, - 'E': logging.ERROR, - 'F': logging.FATAL - } - }, - 'syslog': {'regex': ('[0-9-]{10}T[0-9:]{8}Z (?P' - 'debug|info|notice|warning|err|crit|' - 'alert|emerg)'), - 'levels': {'debug': logging.DEBUG, - 'info': logging.INFO, - 'notice': logging.NOTICE, - 'warning': logging.WARNING, - 'err': logging.ERROR, - 'crit': logging.CRITICAL, - 'alert': logging.ALERT, - 'emerg': logging.EMERG - } - }, - 'anaconda': {'regex': ('[0-9:]{8},[0-9]+ (?P' - 'DEBUG|INFO|WARNING|ERROR|CRITICAL)'), - 'levels': {'DEBUG': logging.DEBUG, - 'INFO': logging.INFO, - 'WARNING': logging.WARNING, - 'ERROR': logging.ERROR, - 'CRITICAL': logging.CRITICAL - } - }, - 'netprobe': {'regex': ('[0-9-]{10} [0-9:]{8},[0-9]+ (?P' - 'DEBUG|INFO|WARNING|ERROR|CRITICAL)'), - 'levels': {'DEBUG': logging.DEBUG, - 'INFO': logging.INFO, - 'WARNING': logging.WARNING, - 'ERROR': logging.ERROR, - 'CRITICAL': logging.CRITICAL - } - } - - } -relevel_errors = { - 'anaconda': [ - { - 'regex': 'Error downloading \ -http://.*/images/(product|updates).img: HTTP response code said error', - 'levelfrom': logging.ERROR, - 'levelto': logging.WARNING - }, - { - 'regex': 'got to setupCdrom without a CD device', - 'levelfrom': logging.ERROR, - 'levelto': logging.WARNING - } - ] -} -# Create a main logger. -logging.basicConfig(format='%(levelname)s: %(message)s') -main_logger = logging.getLogger() -main_logger.setLevel(logging.NOTSET) - - -class WatchedFile: - """WatchedFile(filename) => Object that read lines from file if exist.""" - - def __init__(self, name): - self.name = name - self.fo = None - self.where = 0 - - def reset(self): - if self.fo: - self.fo.close() - self.fo = None - self.where = 0 - - def _checkRewrite(self): - try: - if os.stat(self.name)[6] < self.where: - self.reset() - except OSError: - self.close() - - def readLines(self): - """Return list of last append lines from file if exist.""" - - self._checkRewrite() - if not self.fo: - try: - self.fo = open(self.name, 'r') - except IOError: - return () - lines = self.fo.readlines() - self.where = self.fo.tell() - return lines - - def close(self): - self.reset() - - -class WatchedGroup: - """Can send data from group of specified files to specified servers.""" - - def __init__(self, servers, files, name): - self.servers = servers - self.files = files - self.log_type = files.get('log_type', 'syslog') - self.name = name - self._createLogger() - - def _createLogger(self): - self.watchedfiles = [] - logger = logging.getLogger(self.name) - logger.setLevel(logging.NOTSET) - logger.propagate = False - # Create log formatter. - format_dict = {'version': '1', - 'timestamp': '%(asctime)s', - 'hostname': config['hostname'], - 'appname': self.files['tag'], - 'procid': '-', - 'msgid': '-', - 'structured_data': '-', - 'msg': '%(message)s' - } - log_format = rfc5424_format.format(**format_dict) - formatter = logging.Formatter(log_format, date_format) - # Add log handler for each server. - for server in self.servers: - port = 'port' in server and server['port'] or 514 - syslog = SysLogHandler((server["host"], port)) - syslog.setFormatter(formatter) - logger.addHandler(syslog) - self.logger = logger - # Create WatchedFile objects from list of files. - for name in self.files['files']: - self.watchedfiles.append(WatchedFile(name)) - - def send(self): - """Send append data from files to servers.""" - - for watchedfile in self.watchedfiles: - for line in watchedfile.readLines(): - line = line.strip() - level = self._get_msg_level(line, self.log_type) - # Get rid of duplicated information in anaconda logs - line = re.sub( - msg_levels[self.log_type]['regex'] + "\s*:?\s?", - "", - line - ) - # Ignore meaningless errors - try: - for r in relevel_errors[self.log_type]: - if level == r['levelfrom'] and \ - re.match(r['regex'], line): - level = r['levelto'] - except KeyError: - pass - self.logger.log(level, line) - main_logger and main_logger.log( - level, - 'From file "%s" send: %s' % (watchedfile.name, line) - ) - - @staticmethod - def _get_msg_level(line, log_type): - if log_type in msg_levels: - msg_type = msg_levels[log_type] - regex = re.match(msg_type['regex'], line) - if regex: - return msg_type['levels'][regex.group('level')] - return logging.INFO - - -def sig_handler(signum, frame): - """Send all new data when signal arrived.""" - - if not sending_in_progress: - send_all() - exit(signum) - else: - config['run_once'] = True - - -def send_all(): - """Send any updates.""" - - for group in watchlist: - group.send() - - -def main_loop(): - """Periodicaly call sendlogs() for each group in watchlist.""" - - signal.signal(signal.SIGINT, sig_handler) - signal.signal(signal.SIGTERM, sig_handler) - while watchlist: - time.sleep(0.5) - send_all() - # If asked to run_once, exit now - if config['run_once']: - break - - -class Config: - """Collection of config generation methods. - Usage: config = Config.getConfig() - """ - - @classmethod - def getConfig(cls): - """Generate config from command line arguments and config file.""" - - # example_config = { - # "daemon": True, - # "run_once": False, - # "debug": False, - # "watchlist": [ - # {"servers": [ {"host": "localhost", "port": 514} ], - # "watchfiles": [ - # {"tag": "anaconda", - # "log_type": "anaconda", - # "files": ["/tmp/anaconda.log", - # "/mnt/sysimage/root/install.log"] - # } - # ] - # } - # ] - # } - - default_config = {"daemon": True, - "run_once": False, - "debug": False, - "hostname": cls._getHostname(), - "watchlist": [] - } - # First use default config as running config. - config = dict(default_config) - # Get command line options and validate it. - cmdline = cls.cmdlineParse()[0] - # Check config file source and read it. - if cmdline.config_file or cmdline.stdin_config: - try: - if cmdline.stdin_config is True: - fo = sys.stdin - else: - fo = open(cmdline.config_file, 'r') - parsed_config = json.load(fo) - if cmdline.debug: - print(parsed_config) - except IOError: # Raised if IO operations failed. - main_logger.error("Can not read config file %s\n" % - cmdline.config_file) - exit(1) - except ValueError as e: # Raised if json parsing failed. - main_logger.error("Can not parse config file. %s\n" % - e.message) - exit(1) - # Validate config from config file. - cls.configValidate(parsed_config) - # Copy gathered config from config file to running config - # structure. - for key, value in parsed_config.items(): - config[key] = value - else: - # If no config file specified use watchlist setting from - # command line. - watchlist = {"servers": [{"host": cmdline.host, - "port": cmdline.port}], - "watchfiles": [{"tag": cmdline.tag, - "log_type": cmdline.log_type, - "files": cmdline.watchfiles}]} - config['watchlist'].append(watchlist) - - # Apply behavioural command line options to running config. - if cmdline.no_daemon: - config["daemon"] = False - if cmdline.run_once: - config["run_once"] = True - if cmdline.debug: - config["debug"] = True - return config - - @staticmethod - def _getHostname(): - """Generate hostname by BOOTIF kernel option or use os.uname().""" - - with open('/proc/cmdline') as fo: - cpu_cmdline = fo.readline().strip() - regex = re.search('(?<=BOOTIF=)([0-9a-fA-F-]*)', cpu_cmdline) - if regex: - mac = regex.group(0).upper() - return ''.join(mac.split('-')) - return os.uname()[1] - - @staticmethod - def cmdlineParse(): - """Parse command line config options.""" - - parser = OptionParser() - parser.add_option("-c", "--config", dest="config_file", metavar="FILE", - help="Read config from FILE.") - parser.add_option("-i", "--stdin", dest="stdin_config", default=False, - action="store_true", help="Read config from Stdin.") - # FIXIT Add optionGroups. - parser.add_option("-r", "--run-once", dest="run_once", - action="store_true", help="Send all data and exit.") - parser.add_option("-n", "--no-daemon", dest="no_daemon", - action="store_true", help="Do not daemonize.") - parser.add_option("-d", "--debug", dest="debug", - action="store_true", help="Print debug messages.") - - parser.add_option("-t", "--tag", dest="tag", metavar="TAG", - help="Set tag of sending messages as TAG.") - parser.add_option("-T", "--type", dest="log_type", metavar="TYPE", - default='syslog', - help="Set type of files as TYPE" - "(default: %default).") - parser.add_option("-f", "--watchfile", dest="watchfiles", - action="append", - metavar="FILE", help="Add FILE to watchlist.") - parser.add_option("-s", "--host", dest="host", metavar="HOSTNAME", - help="Set destination as HOSTNAME.") - parser.add_option("-p", "--port", dest="port", type="int", default=514, - metavar="PORT", - help="Set remote port as PORT (default: %default).") - - options, args = parser.parse_args() - # Validate gathered options. - if options.config_file and options.stdin_config: - parser.error("You must not set both options --config" - " and --stdin at the same time.") - exit(1) - if ((options.config_file or options.stdin_config) and - (options.tag or options.watchfiles or options.host)): - main_logger.warning("If --config or --stdin is set up options" - " --tag, --watchfile, --type," - " --host and --port will be ignored.") - if (not (options.config_file or options.stdin_config) and - not (options.tag and options.watchfiles and options.host)): - parser.error("Options --tag, --watchfile and --host" - " must be set up at the same time.") - exit(1) - return options, args - - @staticmethod - def _checkType(value, value_type, value_name='', msg=None): - """Check correctness of type of value and exit if not.""" - - if not isinstance(value, value_type): - message = msg or "Value %r in config have type %r but"\ - " %r is expected." %\ - (value_name, type(value).__name__, value_type.__name__) - main_logger.error(message) - exit(1) - - @classmethod - def configValidate(cls, config): - """Validate types and names of data items in config.""" - - cls._checkType(config, dict, msg='Config must be a dict.') - for key in ("daemon", "run_once", "debug"): - if key in config: - cls._checkType(config[key], bool, key) - key = "hostname" - if key in config: - cls._checkType(config[key], basestring, key) - - key = "watchlist" - if key in config: - cls._checkType(config[key], list, key) - else: - main_logger.error("There must be key %r in config." % key) - exit(1) - - for item in config["watchlist"]: - cls._checkType(item, dict, "watchlist[n]") - key, name = "servers", "watchlist[n] => servers" - if key in item: - cls._checkType(item[key], list, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, '"watchlist[n]" item')) - exit(1) - key, name = "watchfiles", "watchlist[n] => watchfiles" - if key in item: - cls._checkType(item[key], list, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, '"watchlist[n]" item')) - exit(1) - - for item2 in item["servers"]: - cls._checkType(item2, dict, "watchlist[n] => servers[n]") - key, name = "host", "watchlist[n] => servers[n] => host" - if key in item2: - cls._checkType(item2[key], basestring, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, - '"watchlist[n] => servers[n]" item')) - exit(1) - key, name = "port", "watchlist[n] => servers[n] => port" - if key in item2: - cls._checkType(item2[key], int, name) - - for item2 in item["watchfiles"]: - cls._checkType(item2, dict, "watchlist[n] => watchfiles[n]") - key, name = "tag", "watchlist[n] => watchfiles[n] => tag" - if key in item2: - cls._checkType(item2[key], basestring, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, - '"watchlist[n] => watchfiles[n]" item')) - exit(1) - key = "log_type" - name = "watchlist[n] => watchfiles[n] => log_type" - if key in item2: - cls._checkType(item2[key], basestring, name) - key, name = "files", "watchlist[n] => watchfiles[n] => files" - if key in item2: - cls._checkType(item2[key], list, name) - else: - main_logger.error("There must be key %r in %s in config." % - (key, - '"watchlist[n] => watchfiles[n]" item')) - exit(1) - for item3 in item2["files"]: - name = "watchlist[n] => watchfiles[n] => files[n]" - cls._checkType(item3, basestring, name) - - -# Create global config. -config = Config.getConfig() -# Create list of WatchedGroup objects with different log names. -watchlist = [] -i = 0 -for item in config["watchlist"]: - for files in item['watchfiles']: - watchlist.append(WatchedGroup(item['servers'], files, str(i))) - i = i + 1 - -# Fork and loop -if config["daemon"]: - if not os.fork(): - # Redirect the standard I/O file descriptors to the specified file. - main_logger = None - DEVNULL = getattr(os, "devnull", "/dev/null") - os.open(DEVNULL, os.O_RDWR) # standard input (0) - os.dup2(0, 1) # Duplicate standard input to standard output (1) - os.dup2(0, 2) # Duplicate standard input to standard error (2) - - main_loop() - sys.exit(1) - sys.exit(0) -else: - if not config['debug']: - main_logger = None - main_loop() diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/AUTHORS b/contrib/fuel_bootstrap/fuel_bootstrap_cli/AUTHORS deleted file mode 100644 index d1ed52d2..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Artur Svechnikov diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/MANIFEST.in b/contrib/fuel_bootstrap/fuel_bootstrap_cli/MANIFEST.in deleted file mode 100644 index c046acbc..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include AUTHORS -include ChangeLog -exclude .gitignore - -global-exclude *.pyc diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/README.md b/contrib/fuel_bootstrap/fuel_bootstrap_cli/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/README.rst b/contrib/fuel_bootstrap/fuel_bootstrap_cli/README.rst deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/__init__.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/__init__.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/activate.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/activate.py deleted file mode 100644 index 7340598f..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/activate.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from fuel_bootstrap.commands import base -from fuel_bootstrap.utils import bootstrap_image as bs_image - - -class ActivateCommand(base.BaseCommand): - """Activate specified bootstrap image.""" - - def get_parser(self, prog_name): - parser = super(ActivateCommand, self).get_parser(prog_name) - parser.add_argument( - 'id', - type=str, - metavar='ID', - help="ID of bootstrap image to be activated." - ) - return parser - - def take_action(self, parsed_args): - super(ActivateCommand, self).take_action(parsed_args) - # cliff handles errors by itself - image_uuid = bs_image.activate(parsed_args.id) - self.app.stdout.write("Bootstrap image {0} has been activated.\n" - .format(image_uuid)) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/base.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/base.py deleted file mode 100644 index 5d86bc2c..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/base.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from cliff import command - -from fuel_bootstrap import consts -from fuel_bootstrap import settings - -CONF = settings.CONF - - -class BaseCommand(command.Command): - - def get_parser(self, prog_name): - parser = super(BaseCommand, self).get_parser(prog_name) - parser.add_argument( - '--config', - dest='config_file', - type=str, - metavar='FILE', - default=consts.CONFIG_FILE, - help="The config file is to be used for taking configuration" - " parameters from during building of the bootstrap." - ) - return parser - - def take_action(self, parsed_args): - CONF.read(parsed_args.config_file) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/build.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/build.py deleted file mode 100644 index da8782ca..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/build.py +++ /dev/null @@ -1,183 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from fuel_bootstrap.commands import base -from fuel_bootstrap.utils import bootstrap_image as bs_image - - -class BuildCommand(base.BaseCommand): - """Build new bootstrap image with specified parameters.""" - - def get_parser(self, prog_name): - parser = super(BuildCommand, self).get_parser(prog_name) - parser.add_argument( - '--ubuntu-release', - type=str, - help="Choose the Ubuntu release", - ) - parser.add_argument( - '--repo', - dest='repos', - type=str, - metavar='REPOSITORY', - help="Add one more repository. NOTE: The first repo should be" - " release repo. REPOSITORY format:" - " 'type uri codename [sections][,priority]'.", - action='append' - ) - parser.add_argument( - '--http-proxy', - type=str, - metavar='URL', - help="Pass http-proxy URL." - ) - parser.add_argument( - '--https-proxy', - type=str, - metavar='URL', - help="Pass https-proxy URL." - ) - parser.add_argument( - '--direct-repo-addr', - metavar='ADDR', - help="Use a direct connection to repository(address)" - " bypass proxy.", - action='append' - ) - parser.add_argument( - '--script', - dest='post_script_file', - type=str, - metavar='FILE', - help="The script is executed after installing packages (both" - " mandatory and user specified ones) and before creating" - " initramfs." - ) - parser.add_argument( - '--package', - dest='packages', - type=str, - metavar='PKGNAME', - help="The option can be given multiple times, all specified" - " packages and their dependencies will be installed.", - action='append' - ) - parser.add_argument( - '--label', - type=str, - metavar='LABEL', - help="Custom string, which will be presented in bootstrap" - " listing." - ) - parser.add_argument( - '--extra-dir', - dest='extra_dirs', - type=str, - metavar='PATH', - help="Directory that will be injected to the image" - " root filesystem. The option can be given multiple times." - " **NOTE** Files/packages will be" - " injected after installing all packages, but before" - " generating system initramfs - thus it's possible to" - " adjust initramfs.", - action='append' - ) - parser.add_argument( - '--extend-kopts', - type=str, - metavar='OPTS', - help="Extend default kernel options" - ) - parser.add_argument( - '--kernel-flavor', - type=str, - help="Defines kernel version." - ) - parser.add_argument( - '--root-ssh-authorized-file', - type=str, - metavar='FILE', - help="Copy public ssh key into image - makes it possible" - " to login as root into any bootstrap node using the" - " key in question." - ) - parser.add_argument( - '--output-dir', - type=str, - metavar='DIR', - help="Directory to store built image." - ) - parser.add_argument( - '--image-build-dir', - type=str, - metavar='DIR', - help="Which directory should be used for building image." - " /tmp/ will be used by default." - ) - parser.add_argument( - '--activate', - help="Activate bootstrap image after build", - action='store_true' - ) - parser.add_argument( - '--no-default-packages', - help="Do not append default packages", - action='store_true' - ) - parser.add_argument( - '--no-default-direct-repo-addr', - help="Do not append default direct repo address", - action='store_true' - ) - parser.add_argument( - '--no-default-extra-dirs', - help="Do not append default extra directories", - action='store_true' - ) - parser.add_argument( - '--no-compress', - help="Do not compress bootstrap image to tar.gz. Bootstrap" - " files will be stored in output dir. NOTE: Not compressed" - " images are not supported by fuel-bootstrap.", - action='store_true' - ) - parser.add_argument( - '--load-cert', - dest='certs', - metavar='FULL_PATH', - help="Load CA certificate for https connections. Work as extra" - " files", - action='append' - ) - parser.add_argument( - '--root-password', - type=str, - help=("Root password for bootstrap image. PasswordAuthentication" - " by ssh still rejected by default! This password actual" - " only for tty login!"), - ) - return parser - - def take_action(self, parsed_args): - super(BuildCommand, self).take_action(parsed_args) - image_uuid, path = bs_image.make_bootstrap(vars(parsed_args)) - self.app.stdout.write("Bootstrap image {0} has been built: {1}\n" - .format(image_uuid, path)) - if parsed_args.activate: - bs_image.import_image(path) - bs_image.activate(image_uuid) - self.app.stdout.write("Bootstrap image {0} has been activated.\n" - .format(image_uuid)) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/delete.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/delete.py deleted file mode 100644 index 54729d5b..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/delete.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from fuel_bootstrap.commands import base -from fuel_bootstrap.utils import bootstrap_image as bs_image - - -class DeleteCommand(base.BaseCommand): - """Delete specified bootstrap image from the system.""" - - def get_parser(self, prog_name): - parser = super(DeleteCommand, self).get_parser(prog_name) - parser.add_argument( - 'id', - type=str, - metavar='ID', - help="ID of bootstrap image to be deleted" - ) - return parser - - def take_action(self, parsed_args): - super(DeleteCommand, self).take_action(parsed_args) - # cliff handles errors by itself - image_uuid = bs_image.delete(parsed_args.id) - self.app.stdout.write("Bootstrap image {0} has been deleted.\n" - .format(image_uuid)) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/import.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/import.py deleted file mode 100644 index f9ab2b94..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/import.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from fuel_bootstrap.commands import base -from fuel_bootstrap.utils import bootstrap_image as bs_image - - -class ImportCommand(base.BaseCommand): - """Import already created bootstrap image to the system.""" - - def get_parser(self, prog_name): - parser = super(ImportCommand, self).get_parser(prog_name) - # shouldn't we check archive file type? - parser.add_argument( - 'filename', - type=str, - metavar='ARCHIVE_FILE', - help="File name of bootstrap image archive" - ) - parser.add_argument( - '--activate', - help="Activate bootstrap image after import", - action='store_true' - ) - return parser - - def take_action(self, parsed_args): - super(ImportCommand, self).take_action(parsed_args) - # Cliff handles errors by itself - image_uuid = bs_image.import_image(parsed_args.filename) - self.app.stdout.write("Bootstrap image {0} has been imported.\n" - .format(image_uuid)) - if parsed_args.activate: - image_uuid = bs_image.activate(image_uuid) - self.app.stdout.write("Bootstrap image {0} has been activated\n" - .format(image_uuid)) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/list.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/list.py deleted file mode 100644 index 26cd3276..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/commands/list.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from cliff import lister - -from fuelclient.common import data_utils - -from fuel_bootstrap.commands import base -from fuel_bootstrap.utils import bootstrap_image as bs_image - - -class ListCommand(base.BaseCommand, lister.Lister): - """List all available bootstrap images.""" - - columns = ('uuid', 'label', 'status') - - def take_action(self, parsed_args): - super(ListCommand, self).take_action(parsed_args) - data = bs_image.get_all() - data = data_utils.get_display_data_multi(self.columns, data) - return (self.columns, data) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/consts.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/consts.py deleted file mode 100644 index ffbfa4ac..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/consts.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -# These consts shouldn't be configured - -# There is a possibility to specify custom config file with the key --config -CONFIG_FILE = "/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml" -METADATA_FILE = "metadata.yaml" -COMPRESSED_CONTAINER_FORMAT = "tar.gz" -UNCOMPRESSED_CONTAINER_FORMAT = "directory" -ROOTFS = {'name': 'rootfs', - 'mask': 'rootfs', - 'compress_format': 'xz', - 'uri': 'http://127.0.0.1:8080/bootstraps/{uuid}/root.squashfs', - 'format': 'ext4', - 'container': 'raw'} -BOOTSTRAP_MODULES = [ - {'name': 'kernel', - 'mask': 'kernel', - 'uri': 'http://127.0.0.1:8080/bootstraps/{uuid}/vmlinuz'}, - {'name': 'initrd', - 'mask': 'initrd', - 'compress_format': 'xz', - 'uri': 'http://127.0.0.1:8080/bootstraps/{uuid}/initrd.img'}, - ROOTFS -] - -IMAGE_DATA = {'/': ROOTFS} - -# FIXME(azvyagintsev) bug: https://bugs.launchpad.net/fuel/+bug/1525882 -# Nailgun\astute should support API call to change their bootstrap profile -# While its not implemented, we need astute.yaml file to perform -# bootstrap_image._activate_dockerized process -ASTUTE_CONFIG_FILE = "/etc/fuel/astute.yaml" -# FIXME(azvyagintsev) bug: https://bugs.launchpad.net/fuel/+bug/1525857 -DISTROS = {'ubuntu': {'cobbler_profile': 'ubuntu_bootstrap', - 'astute_flavor': 'ubuntu'}} -COBBLER_MANIFEST = '/etc/puppet/modules/fuel/examples/cobbler.pp' -ASTUTE_MANIFEST = '/etc/puppet/modules/fuel/examples/astute.pp' diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/errors.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/errors.py deleted file mode 100644 index 5e2e0a37..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/errors.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -class FuelBootstrapException(Exception): - """Base Exception for Fuel-Bootstrap - - All child classes must be instantiated before raising. - """ - def __init__(self, *args, **kwargs): - super(FuelBootstrapException, self).__init__(*args, **kwargs) - self.message = args[0] - - -class ActiveImageException(FuelBootstrapException): - """Should be raised when action can't be permited to active image""" - - -class ImageAlreadyExists(FuelBootstrapException): - """Should be raised when image with same uuid already exists""" - - -class NotImplemented(FuelBootstrapException): - """Should be raised when some method lacks implementation""" - - -class IncorrectRepository(FuelBootstrapException): - """Should be raised when repository can't be parsed""" - - -class IncorrectImage(FuelBootstrapException): - """Should be raised when image has incorrect format""" - - -class ConfigFileNotExists(FuelBootstrapException): - """Should be raised when default config file is not found""" - - -class WrongCobblerProfile(FuelBootstrapException): - """Should be raised when wrong cobbler profile has been chosen""" - - -class WrongUbuntuRelease(FuelBootstrapException): - """Should be raised when wrong Ubuntu Release profile has been chosen""" diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/hooks.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/hooks.py deleted file mode 100644 index 1db2aa45..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/hooks.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -def setup_hook(config): - import pbr - import pbr.packaging - - # this monkey patch is to avoid appending git version to version - pbr.packaging._get_version_from_git = lambda pre_version: pre_version diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/main.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/main.py deleted file mode 100644 index fa79b5e1..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/main.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import logging -import sys - -from pbr import version - -from cliff import app -from cliff.commandmanager import CommandManager - -LOG = logging.getLogger(__name__) - - -class FuelBootstrap(app.App): - """Main cliff application class. - - Performs initialization of the command manager and - configuration of basic engines. - - """ - - def __init__(self, **kwargs): - super(FuelBootstrap, self).__init__( - description='Command line Fuel bootstrap manager', - version=version.VersionInfo('fuel-bootstrap').version_string(), - command_manager=CommandManager('fuel_bootstrap', - convert_underscores=True), - **kwargs - ) - - def initialize_app(self, argv): - LOG.debug('initialize app') - - def prepare_to_run_command(self, cmd): - LOG.debug('preparing following command to run: %s', - cmd.__class__.__name__) - - def clean_up(self, cmd, result, err): - LOG.debug('clean up %s', cmd.__class__.__name__) - if err: - LOG.debug('got an error: %s', err) - - -def main(argv=sys.argv[1:]): - return FuelBootstrap().run(argv) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/__init__.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/master_node_settings.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/master_node_settings.py deleted file mode 100644 index 943d4a05..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/objects/master_node_settings.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from fuelclient import client - - -class MasterNodeSettings(object): - """Class for working with Fuel master settings""" - - class_api_path = "settings/" - - def __init__(self): - self.connection = client.APIClient.default_client() - - def update(self, data): - return self.connection.put_request( - self.class_api_path, data) - - def get(self): - return self.connection.get_request( - self.class_api_path) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.py deleted file mode 100644 index 3282ee61..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import os -import sys - -import yaml - - -class Configuration(object): - def __init__(self): - self._data = {} - - def read(self, config_file): - data = {} - if os.path.exists(config_file): - with open(config_file) as f: - data = yaml.safe_load(f) - else: - # TODO(atolochkova): need to add logger - sys.stderr.write("The config file couldn't be found: {0}" - .format(config_file)) - self._data = data - - def __getattr__(self, name): - return self._data.get(name) - - -CONF = Configuration() diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.yaml.sample b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.yaml.sample deleted file mode 100644 index 35779a6e..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/settings.yaml.sample +++ /dev/null @@ -1,175 +0,0 @@ ---- -# User can pass any type of executable script -#post_script_file: /tmp/my_custom_script -root_ssh_authorized_file: /root/.ssh/id_rsa.pub -# Extended kernel PXE options -extend_kopts: "biosdevname=0 net.ifnames=1" -# Choose the Ubuntu release (currently supports only Xenial). Keep in mind, -# that you also should fix 'kernel_flavor' parameter. -ubuntu_release: xenial -# Directory that will be injected to the image -# root filesystem. **NOTE** Files/packages will be -# injected after installing all packages, but before -# generating system initramfs - thus it's possible to -# adjust initramfs -extra_dirs: - - /usr/share/fuel_bootstrap_cli/files/xenial -# Save generated bootstrap container to -output_dir: /tmp/ -# Defines kernel version -kernel_flavor: linux-image-generic-lts-xenial -# Define packages list -packages: - - daemonize - - fuel-agent - - hwloc - - i40e-dkms - - linux-firmware - - linux-headers-generic - - live-boot - - live-boot-initramfs-tools - - mc - - mcollective - - msmtp-mta - - multipath-tools - - multipath-tools-boot - - nailgun-agent - - nailgun-mcagents - - network-checker - - ntp - - ntpdate - - openssh-client - - openssh-server - - puppet - - squashfs-tools - - ubuntu-minimal - - vim - - wget - - xz-utils - # NOTE(el): Packages required for new generation - # network checker to be run without an access - # to repositories. - - sysfsutils - - bridge-utils - - ifenslave - - irqbalance - - iputils-arping - # Packages required for distributed serialization - - python-distributed - - python-alembic - - python-amqplib - - python-anyjson - - python-babel - - python-cinderclient - - python-crypto - - python-decorator - - python-fysom - - python-iso8601 - - python-jinja2 - - python-jsonschema - - python-keystoneclient - - python-keystonemiddleware - - python-kombu - - python-mako - - python-markupsafe - - python-migrate - - python-netaddr - - python-netifaces - - python-networkx - - python-novaclient - - python-oslo-config - - python-oslo-db - - python-oslo-serialization - - python-paste - - python-ply - - python-psycopg2 - - python-pydot-ng - - python-requests - - python-simplejson - - python-six - - python-sqlalchemy - - python-stevedore - - python-tz - - python-urllib3 - - python-uwsgidecorators - - python-webpy - - python-wsgilog - - python-yaml - - python-yaql -# Ignore proxy for this repos -#direct_repo_addresses: -# - 127.0.0.1 -# - 172.18.196.50 -# Pass proxy parameters, for access to repos -#http_proxy: "192.168.1.50:8080" -#https_proxy: "192.168.1.50:8080" -# Define repos: upstream ubuntu-mirror, MirantisOpenstack mirror, extra repos. -# First repo should be distro repo. -#repos: -# - -# name: ubuntu -# priority: null -# section: "main universe multiverse" -# suite: xenial -# type: deb -# uri: "http://archive.ubuntu.com/ubuntu" -# - -# name: ubuntu-updates -# priority: null -# section: "main universe multiverse" -# suite: xenial-updates -# type: deb -# uri: "http://archive.ubuntu.com/ubuntu" -# - -# name: ubuntu-security -# priority: null -# section: "main universe multiverse" -# suite: xenial-security -# type: deb -# uri: "http://archive.ubuntu.com/ubuntu" -# - -# name: mos -# priority: "1050" -# section: "main restricted" -# suite: mos10.0 -# type: deb -# uri: "http://mirror.fuel-infra.org/mos-repos/ubuntu/10.0" -# - -# name: mos-updates -# priority: "1050" -# section: "main restricted" -# suite: mos10.0-updates -# type: deb -# uri: "http://mirror.fuel-infra.org/mos-repos/ubuntu/10.0" -# - -# name: mos-security -# priority: "1050" -# section: "main restricted" -# suite: mos10.0-security -# type: deb -# uri: "http://mirror.fuel-infra.org/mos-repos/ubuntu/10.0" -# - -# name: mos-holdback -# priority: "1100" -# section: "main restricted" -# suite: mos10.0-holdback -# type: deb -# uri: "http://mirror.fuel-infra.org/mos-repos/ubuntu/10.0" -# - -# name: Extra_repo -# priority: null -# section: main -# suite: xenial -# type: deb -# uri: "http://archive.ubuntu.com/ubuntu" -# For import\activate commands only. -bootstrap_images_dir: "/var/www/nailgun/bootstraps" -# For import\activate commands only -active_bootstrap_symlink: "/var/www/nailgun/bootstraps/active_bootstrap" -# For import\activate commands only -#"fuel_access" -# "user": "admin" -# "password": "admin" - -# User can provide default hashed root password for bootstrap image -# hashed_root_password: "$6$IInX3Cqo$5xytL1VZbZTusOewFnG6couuF0Ia61yS3rbC6P5YbZP2TYclwHqMq9e3Tg8rvQxhxSlBXP1DZhdUamxdOBXK0." diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/__init__.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/base.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/base.py deleted file mode 100644 index fa739e1f..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/base.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import pytest -import unittest - - -@pytest.mark.usefixtures("bootstrap_app") -class BaseTest(unittest.TestCase): - pass diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/conftest.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/conftest.py deleted file mode 100644 index d20ce453..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/conftest.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import io - -import pytest - -from fuel_bootstrap import main - - -class SafeBootstrapApp(main.FuelBootstrap): - def build_option_parser(self, description, version, argparse_kwargs=None): - parser = super(SafeBootstrapApp, self).build_option_parser( - description, version, argparse_kwargs) - parser.set_defaults(debug=True) - return parser - - def get_fuzzy_matches(self, cmd): - # Turn off guessing, we need exact failures in tests - return [] - - def run(self, argv): - try: - exit_code = super(SafeBootstrapApp, self).run(argv) - except SystemExit as e: - exit_code = e.code - assert exit_code == 0 - - -class SafeStringIO(io.StringIO): - - def write(self, s): - try: - s = unicode(s) - except NameError: - pass - super(SafeStringIO, self).write(s) - - -@pytest.fixture -def bootstrap_app(request): - request.cls.app = SafeBootstrapApp( - stdin=SafeStringIO(), - stdout=SafeStringIO(), - stderr=SafeStringIO() - ) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_activate_command.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_activate_command.py deleted file mode 100644 index 5d477d8d..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_activate_command.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import mock - -from fuel_bootstrap.tests import base - -UUID = 'fake_uuid' - - -class TestActivateCommand(base.BaseTest): - - @mock.patch('fuel_bootstrap.utils.bootstrap_image.activate', - return_value=UUID) - def test_parser(self, mock_activate): - self.app.run(['activate', UUID]) - mock_activate.assert_called_once_with(UUID) - self.assertEqual("Bootstrap image {0} has been activated.\n" - .format(UUID), self.app.stdout.getvalue()) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_app.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_app.py deleted file mode 100644 index a01a2b42..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_app.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from fuel_bootstrap.tests import base - - -class TestApp(base.BaseTest): - - def test_help(self): - self.app.run(['--help']) - self.assertEqual('', self.app.stderr.getvalue()) - self.assertNotIn('Could not', self.app.stdout.getvalue()) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_build_command.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_build_command.py deleted file mode 100644 index 55e1d1c0..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_build_command.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import copy - -import mock - -from fuel_bootstrap import consts -from fuel_bootstrap.tests import base - -PARSED_ARGS = {'extend_kopts': None, - 'no_compress': False, - 'output_dir': None, - 'image_build_dir': None, - 'post_script_file': None, - 'root_ssh_authorized_file': None, - 'activate': False, - 'ubuntu_release': None, - 'root_password': None, - 'no_default_direct_repo_addr': False, - 'https_proxy': None, - 'http_proxy': None, - 'direct_repo_addr': None, - 'label': None, - 'repos': None, - 'kernel_flavor': None, - 'certs': None, - 'extra_dirs': None, - 'no_default_packages': False, - 'no_default_extra_dirs': False, - 'packages': None, - 'config_file': consts.CONFIG_FILE} - -UUID = 'fake_uuid' -PATH = 'fake_path' - - -class TestBuildCommand(base.BaseTest): - @mock.patch('fuel_bootstrap.utils.bootstrap_image.make_bootstrap', - return_value=(UUID, PATH)) - def test_parser(self, mock_make_bootstrap): - self.app.run(['build']) - mock_make_bootstrap.assert_called_once_with(PARSED_ARGS) - self.assertEqual("Bootstrap image {0} has been built: {1}\n" - .format(UUID, PATH), - self.app.stdout.getvalue()) - - @mock.patch('fuel_bootstrap.utils.bootstrap_image.activate', - return_value=(UUID, PATH)) - @mock.patch('fuel_bootstrap.utils.bootstrap_image.import_image', - return_value=UUID) - @mock.patch('fuel_bootstrap.utils.bootstrap_image.make_bootstrap', - return_value=(UUID, PATH)) - def test_parser_activate(self, mock_make_bootstrap, - mock_import, mock_activate): - self.app.run(['build', '--activate']) - parsed_args = copy.deepcopy(PARSED_ARGS) - parsed_args['activate'] = True - mock_make_bootstrap.assert_called_once_with(parsed_args) - mock_import.assert_called_once_with(PATH) - mock_activate.assert_called_once_with(UUID) - self.assertEqual("Bootstrap image {0} has been built: {1}\n" - "Bootstrap image {0} has been activated.\n" - .format(UUID, PATH), - self.app.stdout.getvalue()) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_delete_command.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_delete_command.py deleted file mode 100644 index 2b05e776..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_delete_command.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from fuel_bootstrap.tests import base - -UUID = 'fake_uuid' - - -class TestDeleteCommand(base.BaseTest): - - @mock.patch('fuel_bootstrap.utils.bootstrap_image.delete', - return_value=UUID) - def test_parser(self, mock_delete): - self.app.run(['delete', UUID]) - mock_delete.assert_called_once_with(UUID) - self.assertEqual("Bootstrap image {0} has been deleted.\n" - .format(UUID), self.app.stdout.getvalue()) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_import_command.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_import_command.py deleted file mode 100644 index 7585b0db..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_import_command.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from fuel_bootstrap.tests import base - -UUID = 'fake_uuid' -PATH = 'fake_path' - - -class TestImportCommand(base.BaseTest): - - @mock.patch('fuel_bootstrap.utils.bootstrap_image.import_image', - return_value=UUID) - def test_parser(self, mock_import): - self.app.run(['import', PATH]) - mock_import.assert_called_once_with(PATH) - self.assertEqual("Bootstrap image {0} has been imported.\n" - .format(UUID), self.app.stdout.getvalue()) - - @mock.patch('fuel_bootstrap.utils.bootstrap_image.activate', - return_value=UUID) - @mock.patch('fuel_bootstrap.utils.bootstrap_image.import_image', - return_value=UUID) - def test_parser_activate(self, mock_import, mock_activate): - self.app.run(['import', PATH, '--activate']) - mock_import.assert_called_once_with(PATH) - mock_activate.assert_called_once_with(UUID) - self.assertEqual("Bootstrap image {0} has been imported.\n" - "Bootstrap image {0} has been activated\n" - .format(UUID), self.app.stdout.getvalue()) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_list_command.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_list_command.py deleted file mode 100644 index f9e89ea2..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_list_command.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from fuel_bootstrap.tests import base - - -class TestListCommand(base.BaseTest): - - @mock.patch('fuel_bootstrap.utils.bootstrap_image.get_all') - def test_parser(self, m_get_all): - m_get_all.return_value = [{ - 'uuid': 'fake_uuid', - 'label': 'fake_label', - 'status': 'fake_status', - }] - self.app.run(['list']) - fake_list_result = ("+-----------+------------+-------------+\n" - "| uuid | label | status |\n" - "+-----------+------------+-------------+\n" - "| fake_uuid | fake_label | fake_status |\n" - "+-----------+------------+-------------+\n") - - self.assertEqual(fake_list_result, self.app.stdout.getvalue()) - self.assertEqual('', self.app.stderr.getvalue()) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_requirements.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_requirements.py deleted file mode 100644 index c51891bb..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_requirements.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from pkg_resources import require - - -def test_check_requirements_conflicts(): - require('fuel-bootstrap') diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_bootstrap_image.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_bootstrap_image.py deleted file mode 100644 index b62f7b0a..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_bootstrap_image.py +++ /dev/null @@ -1,370 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import os -import unittest - -import fuel_agent -import mock -from oslo_config import cfg - -from fuel_bootstrap import consts -from fuel_bootstrap import errors -from fuel_bootstrap.utils import bootstrap_image as bs_image -from fuel_bootstrap.utils import data -from fuel_bootstrap.utils import notifier - - -# FAKE_OS is list of tuples which describes fake directories for testing. -# Each tuple has the following structure: -# (root, list_of_directories, list_of_files) -FAKE_OS = [ - ( - '/test', - ['/test/image_1', '/test/image_2', '/test/link_active_bootstrap'], - ['/test/test_file'] - ), - ('/test/image_1', [], ['/test/image_1/metadata.yaml']), - ('/test/image_2', [], []) -] - -DATA = [{'uuid': 'image_1', 'status': 'active'}, {'uuid': 'image_2'}] - -IMAGES_DIR = '/test' - -BOOTSTRAP_SYMLINK = '/test/link_active_bootstrap' - - -def _is_link(dir_path): - return dir_path.startswith('link') - - -def _list_dir(bootstrap_images_dir): - result = [] - for item in FAKE_OS: - if item[0] == bootstrap_images_dir: - result.extend(item[1]) - result.extend(item[2]) - return result - - -def _is_dir(dir_path): - for item in FAKE_OS: - if item[0] == dir_path: - return True - return False - - -def _exists(dir_path): - for root, dirs, files in FAKE_OS: - if dir_path in dirs or dir_path in files: - return True - - -class BootstrapImageTestCase(unittest.TestCase): - def setUp(self): - super(BootstrapImageTestCase, self).setUp() - self.conf_patcher = mock.patch.object(bs_image, 'CONF') - self.conf_mock = self.conf_patcher.start() - - self.conf_mock.bootstrap_images_dir = IMAGES_DIR - self.conf_mock.active_bootstrap_symlink = BOOTSTRAP_SYMLINK - - self.open_patcher = mock.patch('fuel_bootstrap.utils.bootstrap_image.' - 'open', create=True, - new_callable=mock.mock_open) - self.open_mock = self.open_patcher.start() - - self.yaml_patcher = mock.patch('yaml.safe_load') - self.yaml_mock = self.yaml_patcher.start() - - self.dir_patcher = mock.patch('os.listdir') - self.dir_mock = self.dir_patcher.start() - self.dir_mock.side_effect = _list_dir - - self.is_dir_patcher = mock.patch('os.path.isdir') - self.is_dir_mock = self.is_dir_patcher.start() - self.is_dir_mock.side_effect = _is_dir - - self.is_link_patcher = mock.patch('os.path.islink') - self.is_link_mock = self.is_link_patcher.start() - self.is_link_mock.side_effect = _is_link - - self.exists_patcher = mock.patch('os.path.exists') - self.exists_mock = self.exists_patcher.start() - self.exists_mock.side_effect = _exists - - self.walk_patcher = mock.patch('os.walk') - self.walk_mock = self.walk_patcher.start() - self.walk_mock.return_value = [('/test/image_3', - ['directory'], ['file'])] - - def tearDown(self): - mock.patch.stopall() - - @mock.patch.object(bs_image, 'parse', side_effect=DATA) - def test_get_all(self, parse_mock): - result = bs_image.get_all() - self.assertEqual(DATA, result) - self.assertEqual(2, parse_mock.call_count) - parse_mock.assert_has_calls([mock.call('/test/image_1'), - mock.call('/test/image_2')]) - - @mock.patch('os.path.islink', return_value=True) - def test_parse_link(self, islink_mock): - image_uuid = '/test/link_active_bootstrap' - error_msg = "There are no such image \[{0}].".format(image_uuid) - with self.assertRaisesRegexp(errors.IncorrectImage, error_msg): - bs_image.parse(image_uuid) - - @mock.patch('os.path.isdir', return_value=False) - def test_parse_not_dir(self, isdir_mock): - image_uuid = '/test/test_file' - error_msg = "There are no such image \[{0}].".format(image_uuid) - with self.assertRaisesRegexp(errors.IncorrectImage, error_msg): - bs_image.parse(image_uuid) - - def test_parse_no_metadata(self): - image_uuid = '/test/image_2' - error_msg = ("Image \[{0}] doesn't contain metadata file." - .format(image_uuid)) - with self.assertRaisesRegexp(errors.IncorrectImage, error_msg): - bs_image.parse(image_uuid) - - def test_parse_wrong_dir_name(self): - image_uuid = '/test/image_1' - self.yaml_mock.return_value = {'uuid': 'image_2'} - error_msg = ("UUID from metadata file \[{0}] doesn't equal" - " directory name \[{1}]".format('image_2', image_uuid)) - with self.assertRaisesRegexp(errors.IncorrectImage, error_msg): - bs_image.parse(image_uuid) - - @mock.patch.object(bs_image, 'is_active') - def test_parse_correct_image(self, active_mock): - active_mock.return_value = False - image_uuid = '/test/image_1' - self.yaml_mock.return_value = {'uuid': 'image_1'} - expected_data = { - 'uuid': 'image_1', - 'label': '', - 'status': '', - } - data = bs_image.parse(image_uuid) - self.assertEqual(expected_data, data) - - @mock.patch.object(bs_image, 'is_active') - def test_parse_active_image(self, active_mock): - active_mock.return_value = True - image_uuid = '/test/image_1' - self.yaml_mock.return_value = {'uuid': 'image_1'} - expected_data = { - 'uuid': 'image_1', - 'label': '', - 'status': 'active', - } - data = bs_image.parse(image_uuid) - self.assertEqual(expected_data, data) - - @mock.patch.object(bs_image, 'parse') - def test_delete_active_image(self, parse_mock): - parse_mock.return_value = DATA[0] - image_uuid = '/test/image_1' - error_msg = ("Image \[{0}] is active and can't be deleted." - .format(image_uuid)) - - with self.assertRaisesRegexp(errors.ActiveImageException, error_msg): - bs_image.delete(image_uuid) - - @mock.patch.object(bs_image, 'parse') - @mock.patch('shutil.rmtree') - def test_delete(self, shutil_mock, parse_mock): - image_uuid = '/test/image_2' - self.assertEqual(image_uuid, bs_image.delete(image_uuid)) - parse_mock.assert_called_once_with('/test/image_2') - shutil_mock.assert_called_once_with(image_uuid) - - @mock.patch('os.path.realpath', return_value='/test/image_1') - def test_is_active(self, realpath_mock): - image_uuid = '/test/image_1' - self.assertTrue(bs_image.is_active(image_uuid)) - - def test_full_path_not_full(self): - image_uuid = 'image_1' - result = bs_image.full_path(image_uuid) - self.assertEqual(os.path.join(IMAGES_DIR, image_uuid), result) - - def test_full_path_full(self): - image_uuid = '/test/image_1' - result = bs_image.full_path(image_uuid) - self.assertEqual(image_uuid, result) - - @mock.patch('tempfile.mkdtemp') - @mock.patch('fuel_bootstrap.utils.bootstrap_image.extract_to_dir') - def test_import_exists_image(self, extract_mock, tempfile_mock): - self.yaml_mock.return_value = DATA[0] - image_uuid = DATA[0].get('uuid') - error_msg = ("Image \[{0}] already exists.".format(image_uuid)) - with self.assertRaisesRegexp(errors.ImageAlreadyExists, error_msg): - bs_image.import_image('/path') - - @mock.patch('os.chmod') - @mock.patch('shutil.move') - @mock.patch('tempfile.mkdtemp', return_value='/tmp/test') - @mock.patch('fuel_bootstrap.utils.bootstrap_image.extract_to_dir') - def test_import_image(self, extract_mock, tempfile_mock, shutil_mock, - chmod_mock): - arch_path = '/path' - extract_dir = '/tmp/test' - dir_path = '/test/image_3' - self.yaml_mock.return_value = {'uuid': dir_path} - self.assertEqual(bs_image.import_image('/path'), dir_path) - tempfile_mock.assert_called_once_with() - extract_mock.assert_called_once_with(arch_path, extract_dir) - shutil_mock.assert_called_once_with(extract_dir, dir_path) - chmod_mock.assert_has_calls([ - mock.call(dir_path, 0o755), - mock.call(os.path.join(dir_path, 'directory'), 0o755), - mock.call(os.path.join(dir_path, 'file'), 0o755)]) - - @mock.patch('tarfile.open') - def test_extract_to_dir(self, tarfile_mock): - bs_image.extract_to_dir('arch_path', 'extract_path') - tarfile_mock.assert_called_once_with('arch_path', 'r') - tarfile_mock().extractall.assert_called_once_with('extract_path') - - @mock.patch.object(cfg, 'CONF') - @mock.patch.object(fuel_agent.manager, 'Manager') - @mock.patch.object(data, 'BootstrapDataBuilder') - def test_make_bootstrap(self, bdb_mock, manager_mock, conf_mock): - data = {} - boot_data = {'bootstrap': {'uuid': 'image_1'}, - 'output': '/image/path'} - opts = ['--data_driver', 'bootstrap_build_image'] - bdb_mock(data).build.return_value = boot_data - - self.assertEqual(('image_1', '/image/path'), - bs_image.make_bootstrap(data)) - conf_mock.assert_called_once_with(opts, project='fuel-agent') - manager_mock(boot_data).do_mkbootstrap.assert_called_once_with() - - @mock.patch.object(cfg, 'CONF') - @mock.patch.object(fuel_agent.manager, 'Manager') - @mock.patch.object(data, 'BootstrapDataBuilder') - def test_make_bootstrap_image_build_dir(self, - bdb_mock, - manager_mock, - conf_mock): - data = {'image_build_dir': '/image/build_dir'} - boot_data = {'bootstrap': {'uuid': 'image_1'}, - 'output': '/image/path'} - opts = ['--data_driver', 'bootstrap_build_image', - '--image_build_dir', data['image_build_dir']] - bdb_mock(data).build.return_value = boot_data - - self.assertEqual(('image_1', '/image/path'), - bs_image.make_bootstrap(data)) - self.assertEqual(2, bdb_mock.call_count) - conf_mock.assert_called_once_with(opts, project='fuel-agent') - manager_mock(boot_data).do_mkbootstrap.assert_called_once_with() - - def test_update_astute_yaml_key_error(self): - self.yaml_mock.return_value = {} - with self.assertRaises(KeyError): - bs_image._update_astute_yaml() - - def test_update_astute_yaml_type_error(self): - self.yaml_mock.return_value = [] - with self.assertRaises(TypeError): - bs_image._update_astute_yaml() - - @mock.patch('fuel_agent.utils.utils.execute') - def test_run_puppet_no_manifest(self, execute_mock): - bs_image._run_puppet() - execute_mock.assert_called_once_with('puppet', 'apply', - '--detailed-exitcodes', - '-dv', None, logged=True, - check_exit_code=[0, 2], - attempts=2) - - def test_activate_flavor_not_in_distros(self): - flavor = 'not_ubuntu' - error_msg = ('Wrong cobbler profile passed: {0} \n ' - 'possible profiles: \{1}'. - format(flavor, list(consts.DISTROS.keys()))) - with self.assertRaisesRegexp(errors.WrongCobblerProfile, error_msg): - bs_image._activate_flavor(flavor) - - @mock.patch.object(bs_image, '_update_astute_yaml') - @mock.patch.object(bs_image, '_run_puppet') - @mock.patch.object(fuel_agent.utils.utils, 'execute') - def test_activate_flavor(self, - execute_mock, - run_puppet_mock, - update_astute_yaml_mock): - flavor = 'ubuntu' - bs_image._activate_flavor(flavor) - update_astute_yaml_mock.assert_called_once_with( - consts.DISTROS[flavor]['astute_flavor']) - run_puppet_mock.assert_any_call(consts.COBBLER_MANIFEST) - run_puppet_mock.assert_any_call(consts.ASTUTE_MANIFEST) - self.assertEqual(2, run_puppet_mock.call_count) - execute_mock.assert_called_once_with('service', 'astute', 'restart') - - @mock.patch('os.path.lexists', return_value=False) - @mock.patch('os.unlink') - @mock.patch('os.symlink') - def tests_make_symlink(self, symlink_mock, unlink_mock, lexist_mock): - dir_path = '/test/test_image_uuid' - symlink = '/test/active_bootstrap' - bs_image._make_symlink(symlink, dir_path) - lexist_mock.assert_called_once_with(symlink) - unlink_mock.assert_not_called() - symlink_mock.assert_called_once_with(dir_path, symlink) - - @mock.patch('os.path.lexists', return_value=True) - @mock.patch('os.unlink') - @mock.patch('os.symlink') - def tests_make_deteted_symlink(self, symlink_mock, unlink_mock, - lexist_mock): - dir_path = '/test/test_image_uuid' - symlink = '/test/active_bootstrap' - bs_image._make_symlink(symlink, dir_path) - lexist_mock.assert_called_once_with(symlink) - unlink_mock.assert_called_once_with(symlink) - symlink_mock.assert_called_once_with(dir_path, symlink) - - @mock.patch.object(bs_image, '_activate_flavor') - @mock.patch.object(notifier, 'notify_webui') - @mock.patch.object(bs_image, '_make_symlink') - def test_activate_image_symlink_deleted(self, - make_symlink_mock, - notify_mock, - activate_flavor_mock): - image_uuid = '/test/test_image_uuid' - symlink = '/test/active_bootstrap' - self.conf_mock.active_bootstrap_symlink = symlink - self.assertEqual(image_uuid, bs_image._activate_image(image_uuid)) - make_symlink_mock.assert_called_once_with(symlink, image_uuid) - activate_flavor_mock.assert_called_once_with('ubuntu') - notify_mock.assert_called_once_with("") - - @mock.patch.object(bs_image, 'parse') - @mock.patch.object(bs_image, '_activate_image') - def test_activate(self, activate_mock, parse_mock): - image_uuid = '/test/test_image_uuid' - activate_mock.return_value = image_uuid - self.assertEqual(image_uuid, bs_image.activate(image_uuid)) - parse_mock.assert_called_once_with(image_uuid) - activate_mock.assert_called_once_with(image_uuid) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_data.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_data.py deleted file mode 100644 index 5bfafaaa..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/tests/test_utils_data.py +++ /dev/null @@ -1,241 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2016 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import copy -import os - -import mock -import six -import unittest - -from fuel_bootstrap import consts -from fuel_bootstrap import errors -from fuel_bootstrap.utils import data as bs_data - -DATA = {'ubuntu_release': 'trusty', - 'repos': ['deb http://archive.ubuntu.com/ubuntu suite'], - 'post_script_file': None, - 'root_ssh_authorized_file': '/root/test', - 'extra_dirs': ['/test_extra_dirs'], - 'packages': [], - 'label': None, - 'no_default_extra_dirs': True, - 'no_default_packages': True, - 'extend_kopts': 'test_extend_kopts', - 'kernel_flavor': 'test_kernel_flavor', - 'output_dir': '/test_dir', - 'certs': None, - 'root_password': '1234567_abc' - } - -BOOTSTRAP_MODULES = [ - {'name': 'kernel', - 'mask': 'kernel', - 'uri': 'http://127.0.0.1:8080/bootstraps/123/vmlinuz'}, - {'name': 'initrd', - 'mask': 'initrd', - 'compress_format': 'xz', - 'uri': 'http://127.0.0.1:8080/bootstraps/123/initrd.img'}, - {'name': 'rootfs', - 'mask': 'rootfs', - 'compress_format': 'xz', - 'uri': 'http://127.0.0.1:8080/bootstraps/123/root.squashfs', - 'format': 'ext4', - 'container': 'raw'} -] - -REPOS = [{'name': 'repo_0', - 'type': 'deb', - 'uri': 'http://archive.ubuntu.com/ubuntu', - 'priority': None, - 'suite': 'suite', - 'section': ''}] - -IMAGE_DATA = {'/': {'name': 'rootfs', - 'mask': 'rootfs', - 'compress_format': 'xz', - 'uri': 'http://127.0.0.1:8080/bootstraps/123/' - 'root.squashfs', - 'format': 'ext4', - 'container': 'raw'}} - -UUID = six.text_type(123) - - -class DataBuilderTestCase(unittest.TestCase): - @mock.patch('uuid.uuid4', return_value=UUID) - def setUp(self, uuid): - super(DataBuilderTestCase, self).setUp() - self.bd_builder = bs_data.BootstrapDataBuilder(DATA) - - def test_build(self): - proxy_settings = {} - file_name = "{0}.{1}".format(UUID, consts.COMPRESSED_CONTAINER_FORMAT) - packages = [DATA.get('kernel_flavor')] - bootstrap = { - 'bootstrap': { - 'modules': BOOTSTRAP_MODULES, - 'extend_kopts': DATA.get('extend_kopts'), - 'post_script_file': DATA.get('post_script_file'), - 'uuid': UUID, - 'extra_files': DATA.get('extra_dirs'), - 'root_ssh_authorized_file': - DATA.get('root_ssh_authorized_file'), - 'container': { - 'meta_file': consts.METADATA_FILE, - 'format': consts.COMPRESSED_CONTAINER_FORMAT - }, - 'label': UUID, - 'certs': DATA.get('certs') - }, - 'repos': REPOS, - 'proxies': proxy_settings, - 'codename': DATA.get('ubuntu_release'), - 'output': os.path.join(DATA.get('output_dir'), file_name), - 'packages': packages, - 'image_data': IMAGE_DATA, - 'hashed_root_password': None, - 'root_password': DATA.get('root_password') - } - data = self.bd_builder.build() - self.assertEqual(data, bootstrap) - - def test_get_extra_dirs_no_default(self): - result = self.bd_builder._get_extra_dirs() - self.assertEqual(result, DATA.get('extra_dirs')) - - @mock.patch.object(bs_data, 'CONF') - def test_get_extra_dirs(self, conf_mock): - self.bd_builder.no_default_extra_dirs = False - conf_mock.extra_dirs = ['/conf_test_extra_dirs'] - result = self.bd_builder._get_extra_dirs() - six.assertCountEqual(self, result, DATA.get('extra_dirs') + - ['/conf_test_extra_dirs']) - - def test_prepare_modules(self): - result = self.bd_builder._prepare_modules() - self.assertEqual(result, BOOTSTRAP_MODULES) - - def test_prepare_image_data(self): - result = self.bd_builder._prepare_image_data() - self.assertEqual(result, IMAGE_DATA) - - def test_get_no_proxy_settings(self): - self.assertEqual(self.bd_builder._get_proxy_settings(), {}) - - @mock.patch.object(bs_data, 'CONF') - def test_get_proxy_settings(self, conf_mock): - conf_mock.direct_repo_addresses = None - self.bd_builder.http_proxy = '127.0.0.1' - self.bd_builder.https_proxy = '127.0.0.2' - self.bd_builder.direct_repo_addr = ['127.0.0.3'] - proxy = {'protocols': {'http': self.bd_builder.http_proxy, - 'https': self.bd_builder.https_proxy}, - 'direct_repo_addr_list': self.bd_builder.direct_repo_addr} - result = self.bd_builder._get_proxy_settings() - self.assertEqual(result, proxy) - - def test_get_direct_repo_addr_no_default(self): - self.bd_builder.no_default_direct_repo_addr = True - self.bd_builder.direct_repo_addr = ['127.0.0.3'] - result = self.bd_builder._get_direct_repo_addr() - self.assertEqual(result, self.bd_builder.direct_repo_addr) - - @mock.patch.object(bs_data, 'CONF') - def test_get_direct_repo_addr_conf(self, conf_mock): - self.bd_builder.direct_repo_addr = ['127.0.0.3'] - conf_mock.direct_repo_addresses = ['127.0.0.4'] - result = self.bd_builder._get_direct_repo_addr() - six.assertCountEqual(self, result, - self.bd_builder.direct_repo_addr + ['127.0.0.4']) - - @mock.patch.object(bs_data, 'CONF') - def test_get_direct_repo_addr(self, conf_mock): - conf_mock.direct_repo_addresses = None - self.bd_builder.direct_repo_addr = ['127.0.0.3'] - result = self.bd_builder._get_direct_repo_addr() - self.assertEqual(result, self.bd_builder.direct_repo_addr) - - @mock.patch.object(bs_data, 'CONF') - def test_get_repos_conf(self, conf_mock): - self.bd_builder.repos = [] - conf_mock.repos = REPOS - self.assertEqual(self.bd_builder._get_repos(), conf_mock.repos) - - @mock.patch.object(bs_data, 'CONF') - def test_get_repos(self, conf_mock): - conf_mock.repos = None - self.assertEqual(self.bd_builder._get_repos(), REPOS) - - def test_get_packages_no_default(self): - packages = copy.copy(DATA.get('packages')) - packages.append(DATA.get('kernel_flavor')) - six.assertCountEqual(self, self.bd_builder._get_packages(), packages) - - @mock.patch.object(bs_data, 'CONF') - def test_get_packages(self, conf_mock): - self.bd_builder.packages = ['test_package'] - self.bd_builder.no_default_packages = False - conf_mock.packages = ['conf_package'] - result_packages = (self.bd_builder.packages + conf_mock.packages - + [DATA.get('kernel_flavor')]) - six.assertCountEqual(self, self.bd_builder._get_packages(), - result_packages) - - def parse_incorrect(self, repo): - name = 'repo_0' - error_msg = "Couldn't parse repository '{0}'".format(repo) - with self.assertRaises(errors.IncorrectRepository, msg=error_msg): - bs_data.BootstrapDataBuilder._parse_repo(repo, name) - - def test_parse_incorrect_type(self): - repo = 'deb-false http://archive.ubuntu.com/ubuntu codename' - self.parse_incorrect(repo) - - def test_parse_empty_uri(self): - repo = 'deb codename' - self.parse_incorrect(repo) - - def test_parse_empty_suite(self): - repo = 'deb http://archive.ubuntu.com/ubuntu' - self.parse_incorrect(repo) - - def parse_correct(self, repo, return_repo): - name = 'repo_0' - result = bs_data.BootstrapDataBuilder._parse_repo(repo, name) - self.assertEqual(result, return_repo) - - def test_parse_correct_necessary(self): - repo = DATA.get('repos')[0] - self.parse_correct(repo, REPOS[0]) - - def test_parse_correct_section(self): - repo = 'deb http://archive.ubuntu.com/ubuntu suite section' - return_repo = copy.deepcopy(REPOS[0]) - return_repo['section'] = 'section' - self.parse_correct(repo, return_repo) - - def test_parse_correct_priority(self): - repo = 'deb http://archive.ubuntu.com/ubuntu suite ,1' - return_repo = copy.deepcopy(REPOS[0]) - return_repo['priority'] = '1' - self.parse_correct(repo, return_repo) - - def test_parse_correct_all(self): - repo = 'deb http://archive.ubuntu.com/ubuntu suite section,1' - return_repo = copy.deepcopy(REPOS[0]) - return_repo['section'] = 'section' - return_repo['priority'] = '1' - self.parse_correct(repo, return_repo) diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/__init__.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/bootstrap_image.py b/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/bootstrap_image.py deleted file mode 100644 index b26e5619..00000000 --- a/contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap/utils/bootstrap_image.py +++ /dev/null @@ -1,270 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2015 Mirantis, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import logging -import os -import re -import shutil -import tarfile -import tempfile -import yaml - -from fuel_agent import manager -from fuel_agent.utils import utils -from oslo_config import cfg - -from fuel_bootstrap import consts -from fuel_bootstrap import errors -from fuel_bootstrap import settings -from fuel_bootstrap.utils import data as data_util -from fuel_bootstrap.utils import notifier - -CONF = settings.CONF -LOG = logging.getLogger(__name__) -ACTIVE = 'active' - - -def get_all(): - """Return info about all valid bootstrap images - - :return: array of dict - """ - # TODO(asvechnikov): need to change of determining active bootstrap - # cobbler profile must be used - data = [] - LOG.debug("Searching images in %s", CONF.bootstrap_images_dir) - for name in os.listdir(CONF.bootstrap_images_dir): - if not os.path.isdir(os.path.join(CONF.bootstrap_images_dir, name)): - continue - try: - data.append(parse(name)) - except errors.IncorrectImage as e: - LOG.debug("Image [%s] is skipped due to %s", name, e) - return data - - -def _cobbler_profile(): - """Parse current active profile from cobbler system - - :return: string - """ - - stdout, _ = utils.execute('cobbler', 'system', 'report', - '--name', 'default') - regex = r"(?P