2020-08-18 09:33:47 +01:00
|
|
|
{ lib
|
2022-01-28 13:44:02 +00:00
|
|
|
, nixosTests
|
2020-08-18 09:33:47 +01:00
|
|
|
, buildPythonApplication
|
|
|
|
, cloud-utils
|
2021-11-28 12:26:00 +00:00
|
|
|
, dmidecode
|
|
|
|
, fetchFromGitHub
|
2022-01-28 13:44:02 +00:00
|
|
|
, iproute2
|
2020-08-18 09:33:47 +01:00
|
|
|
, openssh
|
2021-11-28 12:26:00 +00:00
|
|
|
, python3
|
|
|
|
, shadow
|
2022-01-28 13:44:02 +00:00
|
|
|
, systemd
|
2020-08-18 09:33:47 +01:00
|
|
|
}:
|
2014-10-17 15:09:20 +01:00
|
|
|
|
2021-11-28 12:26:00 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "cloud-init";
|
2021-11-28 12:26:00 +00:00
|
|
|
version = "21.4";
|
2014-10-17 15:09:20 +01:00
|
|
|
namePrefix = "";
|
|
|
|
|
2020-08-18 09:33:47 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "canonical";
|
|
|
|
repo = "cloud-init";
|
|
|
|
rev = version;
|
2021-11-28 12:26:00 +00:00
|
|
|
sha256 = "09413qz9y2csvhjb4krjnkfj97vlykx79j912p27jjcrg82f1nib";
|
2014-10-17 15:09:20 +01:00
|
|
|
};
|
|
|
|
|
2020-08-18 09:33:47 +01:00
|
|
|
patches = [ ./0001-add-nixos-support.patch ];
|
2021-11-28 12:26:00 +00:00
|
|
|
|
2017-04-21 09:55:14 +01:00
|
|
|
prePatch = ''
|
2021-11-28 12:26:00 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace /lib/systemd $out/lib/systemd
|
2022-01-28 13:44:02 +00:00
|
|
|
|
|
|
|
substituteInPlace cloudinit/net/networkd.py \
|
|
|
|
--replace "['/usr/sbin', '/bin']" "['/usr/sbin', '/bin', '${iproute2}/bin', '${systemd}/bin']"
|
|
|
|
|
|
|
|
substituteInPlace tests/unittests/test_net_activators.py \
|
|
|
|
--replace "['/usr/sbin', '/bin']" \
|
|
|
|
"['/usr/sbin', '/bin', '${iproute2}/bin', '${systemd}/bin']"
|
2020-08-18 09:33:47 +01:00
|
|
|
'';
|
2015-01-08 09:26:49 +00:00
|
|
|
|
2020-08-18 09:33:47 +01:00
|
|
|
postInstall = ''
|
|
|
|
install -D -m755 ./tools/write-ssh-key-fingerprints $out/libexec/write-ssh-key-fingerprints
|
|
|
|
for i in $out/libexec/*; do
|
|
|
|
wrapProgram $i --prefix PATH : "${lib.makeBinPath [ openssh ]}"
|
|
|
|
done
|
|
|
|
'';
|
2017-04-21 11:48:02 +01:00
|
|
|
|
2021-11-28 12:26:00 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
configobj
|
2020-08-18 09:33:47 +01:00
|
|
|
jinja2
|
2021-11-28 12:26:00 +00:00
|
|
|
jsonpatch
|
|
|
|
jsonschema
|
|
|
|
netifaces
|
2020-08-18 09:33:47 +01:00
|
|
|
oauthlib
|
|
|
|
pyyaml
|
|
|
|
requests
|
|
|
|
];
|
2017-06-05 20:41:31 +01:00
|
|
|
|
2021-11-28 12:26:00 +00:00
|
|
|
checkInputs = with python3.pkgs; [
|
2020-08-18 09:33:47 +01:00
|
|
|
pytestCheckHook
|
|
|
|
httpretty
|
|
|
|
dmidecode
|
|
|
|
# needed for tests; at runtime we rather want the setuid wrapper
|
|
|
|
shadow
|
|
|
|
];
|
2014-10-17 15:09:20 +01:00
|
|
|
|
2020-08-18 09:33:47 +01:00
|
|
|
makeWrapperArgs = [
|
2021-07-05 17:32:26 +01:00
|
|
|
"--prefix PATH : ${lib.makeBinPath [ dmidecode cloud-utils.guest ]}/bin"
|
2020-08-18 09:33:47 +01:00
|
|
|
];
|
2014-10-17 15:09:20 +01:00
|
|
|
|
2020-08-18 09:33:47 +01:00
|
|
|
disabledTests = [
|
|
|
|
# tries to create /var
|
|
|
|
"test_dhclient_run_with_tmpdir"
|
|
|
|
# clears path and fails because mkdir is not found
|
|
|
|
"test_path_env_gets_set_from_main"
|
2020-10-15 00:09:00 +01:00
|
|
|
# tries to read from /etc/ca-certificates.conf while inside the sandbox
|
|
|
|
"test_handler_ca_certs"
|
2021-07-05 17:32:26 +01:00
|
|
|
# Doesn't work in the sandbox
|
|
|
|
"TestEphemeralDhcpNoNetworkSetup"
|
|
|
|
"TestHasURLConnectivity"
|
|
|
|
"TestReadFileOrUrl"
|
|
|
|
"TestConsumeUserDataHttp"
|
|
|
|
# Chef Omnibus
|
|
|
|
"TestInstallChefOmnibus"
|
2021-07-25 20:49:41 +01:00
|
|
|
# https://github.com/canonical/cloud-init/pull/893
|
|
|
|
"TestGetPackageMirrorInfo"
|
2021-11-28 12:26:00 +00:00
|
|
|
# Disable failing VMware and PuppetAio tests
|
|
|
|
"test_get_data_iso9660_with_network_config"
|
|
|
|
"test_get_data_vmware_guestinfo_with_network_config"
|
|
|
|
"test_get_host_info"
|
|
|
|
"test_no_data_access_method"
|
|
|
|
"test_install_with_collection"
|
|
|
|
"test_install_with_custom_url"
|
|
|
|
"test_install_with_default_arguments"
|
|
|
|
"test_install_with_no_cleanup"
|
|
|
|
"test_install_with_version"
|
2021-07-05 17:32:26 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# Oracle tests are not passing
|
|
|
|
"cloudinit/sources/tests/test_oracle.py"
|
|
|
|
# Disable the integration tests. pycloudlib would be required
|
|
|
|
"tests/unittests/test_datasource/test_aliyun.py"
|
|
|
|
"tests/unittests/test_datasource/test_azure.py"
|
|
|
|
"tests/unittests/test_datasource/test_ec2.py"
|
|
|
|
"tests/unittests/test_datasource/test_exoscale.py"
|
|
|
|
"tests/unittests/test_datasource/test_gce.py"
|
|
|
|
"tests/unittests/test_datasource/test_openstack.py"
|
|
|
|
"tests/unittests/test_datasource/test_scaleway.py"
|
|
|
|
"tests/unittests/test_ec2_util.py"
|
2020-08-18 09:33:47 +01:00
|
|
|
];
|
2017-12-11 11:04:06 +00:00
|
|
|
|
2020-08-18 09:33:47 +01:00
|
|
|
preCheck = ''
|
|
|
|
# TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build
|
|
|
|
export TMPDIR=/tmp
|
|
|
|
'';
|
2017-12-11 11:04:06 +00:00
|
|
|
|
2021-11-28 12:26:00 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"cloudinit"
|
|
|
|
];
|
2021-07-05 17:32:26 +01:00
|
|
|
|
2022-01-28 14:05:08 +00:00
|
|
|
passthru.tests.cloud-init = nixosTests.cloud-init;
|
|
|
|
|
2021-03-02 15:53:19 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://cloudinit.readthedocs.org";
|
2016-06-20 11:53:46 +01:00
|
|
|
description = "Provides configuration and customization of cloud instance";
|
2021-08-22 10:41:13 +01:00
|
|
|
license = with licenses; [ asl20 gpl3Plus ];
|
2021-03-02 15:53:19 +00:00
|
|
|
maintainers = with maintainers; [ madjar phile314 ];
|
|
|
|
platforms = platforms.all;
|
2014-10-17 15:09:20 +01:00
|
|
|
};
|
|
|
|
}
|