← Back to team overview

cloud-init team mailing list archive

Re: I need help on adding a new bistro to cloud-init

 

That exception means that the code you're running/testing is
attempting to call a subprocess that would either make changes to, or
gather information from, the underlying system. This may not be
specific to your code and happens all the time in cloud-init, but we
don't want that happening in unit tests as that would likely mean
we're relying on an implementation detail of your specific system, or
worse, attempting to make changes to your system. In order to fix it,
you need to mock the process or service being called. In this case,
you likely need to mock "cloudinit.config.cc_ntp.subp"

In the future, when discussing the specifics of implementation
details, it would probably be easiest to do that from Github with a
pull request. If you could submit a pull request, then add the 'WIP'
label, that will indicate that the code is a work in progress, and we
know not to review or merge it yet. The PR makes it easier to
highlight details or ask questions about a particular part of the
code.

Thanks,
James

On Sun, May 23, 2021 at 9:56 AM Shreenidhi Shedi <sshedi@xxxxxxxxxx> wrote:
>
> Hi All,
>
> I am trying to add some test cases for the changes I have been doing.
> For some reason ntp related tests are failing. (Find the attached for error logs)
>
> The interesting thing is, this error happens only when I do `pytest tests/unittests/`
> And if I run `pytest ./tests/unittests/test_distros/test_netconfig.py` no error is shown.
>
> I'm also attaching my test_netconfig.py (class TestNetCfgDistroPhoton are my changes).
> Any inputs?
>
> --
> Shedi
>
>
> On 21/05/21, 10:36 PM, "Cloud-init on behalf of Shreenidhi Shedi" <cloud-init-bounces+sshedi=vmware.com@xxxxxxxxxxxxxxxxxxx on behalf of sshedi@xxxxxxxxxx> wrote:
>
>     Thanks James. I will go through the given links and try to understand things better.
>
>     --
>     Shedi
>
>
>     On 21/05/21, 7:10 PM, "James Falcon" <james.falcon@xxxxxxxxxxxxx> wrote:
>
>         Shedi,
>
>         It looks like you've already done the hardest work, which is
>         overriding the Distro class for your needs. For everything else, the
>         easiest way to get started would be to take a look at a previous PR
>         that added a new distro. For example, support for AlmaLinux (a rhel
>         based distro) was recently added in this PR:
>         https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcanonical%2Fcloud-init%2Fpull%2F872%2Ffiles&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840264158%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=u9Cps9T6g4oVhbr%2B5E8%2BBASzE1%2F2H%2BwfQ27D52iQv%2Bg%3D&amp;reserved=0
>
>         You'll see some various distro lists, setup files, and systemd units
>         that you may need to add your distro to.
>
>         For testing locally, you'll see where unit tests were added in that
>         AlmaLinux PR. Generally, you'll want to ensure that your distro is
>         correctly identified and that any new behavior you add works as
>         expected. Unit tests can be run by calling "pytest" with the filename
>         you wish to test (they'll also run on our CI when you submit a PR).
>         Guidelines for unit tests can be found here:
>         https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcloudinit.readthedocs.io%2Fen%2Flatest%2Ftopics%2Ftesting.html&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840264158%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=abyyUi3xZFpvXeFAipkOi41eqQMN8%2BV8QiA8%2B0jCyRQ%3D&amp;reserved=0
>
>         For running/debugging your distro locally, KVM is probably your best
>         bet. See the documentation here (using your image instead of the one
>         referenced):
>         https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcloudinit.readthedocs.io%2Fen%2Flatest%2Ftopics%2Fdebugging.html%23analyze-quickstart-kvm&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840264158%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=gbZuZ%2BasiiNKCtcV0s43dOXw83OxoFnpV82ElLPLpMQ%3D&amp;reserved=0
>
>         For the actual process of creating and submitting a PR, we have
>         documentation here:
>         https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcloudinit.readthedocs.io%2Fen%2Flatest%2Ftopics%2Fhacking.html%23submitting-your-first-pull-request&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840264158%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=iHbt7w1OgKKLJG1QCKVLuUMNM0gpyn%2BJZxPLh95kEq8%3D&amp;reserved=0
>
>         Hope that helps!
>
>         - James
>
>         On Thu, May 20, 2021 at 1:51 PM Shreenidhi Shedi <sshedi@xxxxxxxxxx> wrote:
>         >
>         > Hi All,
>         >
>         >
>         >
>         > Hope you all are doing well.
>         >
>         > I am interested in contributing to cloud-init and I submitted one minor documentation fix to cloud-init sometime back.
>         >
>         > I work on VMware’s open source OS Photon - https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvmware.github.io%2Fphoton%2Fassets%2Ffiles%2Fhtml%2F3.0%2FIntroduction.html&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=xGBkUJiB4n3UUxTggzZ2OjdaYIj20oMOfDABn8C2iyc%3D&amp;reserved=0
>         >
>         > We have our own distro specific things and we have https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvmware%2Fphoton%2Fblob%2Fdev%2FSPECS%2Fcloud-init%2Fphoton-distro.patch&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=4vbsfm4UKnsjdS%2FFGVCcREi13cnCsvB4Ton%2FuTPFLLk%3D&amp;reserved=0
>         >
>         > And using this patch in our spec file.
>         >
>         >
>         >
>         > I want to make it a part of upstream cloud-init and would like to know how can I get started in this regard.
>         >
>         > What are the tests I need to add, how can I test my changes in my local build machine and so on.
>         >
>         >
>         >
>         > Appreciate any kind of help in this regard.
>         >
>         >
>         >
>         > --
>         >
>         > Shedi
>         >
>         >
>         >
>         > --
>         > Mailing list: https://nam04.safelinks.protection.outlook.com/?url=https:%2F%2Flaunchpad.net%2F~cloud-init&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=uM1EUIktgr%2Fu0ZUXGdVoHGnYGQqU3sL1N9ZbEfDReVU%3D&amp;reserved=0
>         > Post to     : cloud-init@xxxxxxxxxxxxxxxxxxx
>         > Unsubscribe : https://nam04.safelinks.protection.outlook.com/?url=https:%2F%2Flaunchpad.net%2F~cloud-init&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=uM1EUIktgr%2Fu0ZUXGdVoHGnYGQqU3sL1N9ZbEfDReVU%3D&amp;reserved=0
>         > More help   : https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhelp.launchpad.net%2FListHelp&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Sm3BKFL6xHDnG%2FgK7gc3Nt1xEG1z%2FDNQfmGdOfK3Oqo%3D&amp;reserved=0
>
>     --
>     Mailing list: https://nam04.safelinks.protection.outlook.com/?url=https:%2F%2Flaunchpad.net%2F~cloud-init&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=uM1EUIktgr%2Fu0ZUXGdVoHGnYGQqU3sL1N9ZbEfDReVU%3D&amp;reserved=0
>     Post to     : cloud-init@xxxxxxxxxxxxxxxxxxx
>     Unsubscribe : https://nam04.safelinks.protection.outlook.com/?url=https:%2F%2Flaunchpad.net%2F~cloud-init&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840274149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=uM1EUIktgr%2Fu0ZUXGdVoHGnYGQqU3sL1N9ZbEfDReVU%3D&amp;reserved=0
>     More help   : https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhelp.launchpad.net%2FListHelp&amp;data=04%7C01%7Csshedi%40vmware.com%7C7f7f20af1f3241ad680a08d91c7ac269%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637572135840284148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=WctjYNzdKRriCsSmbO4Pv3z51C8rDz0a6YrHkBk%2BjQk%3D&amp;reserved=0
>


References