From 3cd329b914833447b17d6786be8c517b6c3c4f0b Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Jun 10 2022 07:07:28 +0000 Subject: copr-be: move helpers.py on a syncronized place? Could help with eb1c4410e83708c1b3f2e138bfbc7a307bb02250 --- diff --git a/roles/copr/backend/files/provision/helpers.py b/roles/copr/backend/files/provision/helpers.py new file mode 100644 index 0000000..35fd7d3 --- /dev/null +++ b/roles/copr/backend/files/provision/helpers.py @@ -0,0 +1,53 @@ +def get_hv_identification_from_pool_id(pool_id): + """ Get unique ID of the hypervisor """ + if pool_id.startswith("copr_hv_x86_64_01"): + return ( + 0, + "qemu+ssh://copr@vmhost-x86-copr01" + ".rdu-cc.fedoraproject.org/system", + "x86_64", + ) + if pool_id.startswith("copr_hv_x86_64_02"): + return ( + 1, + "qemu+ssh://copr@vmhost-x86-copr02" + ".rdu-cc.fedoraproject.org/system", + "x86_64", + ) + if pool_id.startswith("copr_hv_x86_64_03"): + return ( + 2, + "qemu+ssh://copr@vmhost-x86-copr03" + ".rdu-cc.fedoraproject.org/system", + "x86_64", + ) + if pool_id.startswith("copr_hv_x86_64_04"): + return ( + 3, + "qemu+ssh://copr@vmhost-x86-copr04" + ".rdu-cc.fedoraproject.org/system", + "x86_64", + ) + if pool_id.startswith("copr_hv_ppc64le_01"): + return ( + 4, + "qemu+ssh://copr@vmhost-p08-copr01" + ".rdu-cc.fedoraproject.org/system", + "ppc64le", + ) + if pool_id.startswith("copr_hv_ppc64le_02"): + return ( + 5, + "qemu+ssh://copr@vmhost-p08-copr02" + ".rdu-cc.fedoraproject.org/system", + "ppc64le", + ) + + if pool_id.startswith("copr_p09_01"): + return ( + 6, + "qemu+ssh://copr@vmhost-p09-copr01" + ".rdu-cc.fedoraproject.org/system", + "ppc64le", + ) + raise Exception("can't convert pool_id to hv ID") diff --git a/roles/copr/backend/templates/provision/helpers.py b/roles/copr/backend/templates/provision/helpers.py deleted file mode 100644 index 35fd7d3..0000000 --- a/roles/copr/backend/templates/provision/helpers.py +++ /dev/null @@ -1,53 +0,0 @@ -def get_hv_identification_from_pool_id(pool_id): - """ Get unique ID of the hypervisor """ - if pool_id.startswith("copr_hv_x86_64_01"): - return ( - 0, - "qemu+ssh://copr@vmhost-x86-copr01" - ".rdu-cc.fedoraproject.org/system", - "x86_64", - ) - if pool_id.startswith("copr_hv_x86_64_02"): - return ( - 1, - "qemu+ssh://copr@vmhost-x86-copr02" - ".rdu-cc.fedoraproject.org/system", - "x86_64", - ) - if pool_id.startswith("copr_hv_x86_64_03"): - return ( - 2, - "qemu+ssh://copr@vmhost-x86-copr03" - ".rdu-cc.fedoraproject.org/system", - "x86_64", - ) - if pool_id.startswith("copr_hv_x86_64_04"): - return ( - 3, - "qemu+ssh://copr@vmhost-x86-copr04" - ".rdu-cc.fedoraproject.org/system", - "x86_64", - ) - if pool_id.startswith("copr_hv_ppc64le_01"): - return ( - 4, - "qemu+ssh://copr@vmhost-p08-copr01" - ".rdu-cc.fedoraproject.org/system", - "ppc64le", - ) - if pool_id.startswith("copr_hv_ppc64le_02"): - return ( - 5, - "qemu+ssh://copr@vmhost-p08-copr02" - ".rdu-cc.fedoraproject.org/system", - "ppc64le", - ) - - if pool_id.startswith("copr_p09_01"): - return ( - 6, - "qemu+ssh://copr@vmhost-p09-copr01" - ".rdu-cc.fedoraproject.org/system", - "ppc64le", - ) - raise Exception("can't convert pool_id to hv ID")