Testinfra is choosing Upstart for CentOS 6 as service provider
See original GitHub issueHello,
I’ve been tracking down some failing tests and I’ve noticed that testinfra 1.6.5
is picking up the Upstart
service provider for my test case for CentOS 6, which feels wrong and it should be choosing the SysvService
instead.
Here’s an example:
@pytest.mark.docker_images('centos:6')
def test_httpd_service_starts_up_through_etc_initd(host, wait_for_svc):
svc = host.run('/etc/init.d/httpd start')
wait_for_svc(host, 'start', timeout=5)
assert svc.rc == 0
> assert host.service('httpd').is_running
E AssertionError: assert False
E + where False = <service httpd>.is_running
E + where <service httpd> = <class 'testinfra.modules.base.UpstartService'>('httpd')
E + where <class 'testinfra.modules.base.UpstartService'> = <testinfra.host.Host object at 0x7fd013d85310>.service
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (15 by maintainers)
Top Results From Across the Web
Testinfra is choosing Upstart for CentOS 6 as service provider
Hello, I've been tracking down some failing tests and I've noticed that testinfra 1.6.5 is picking up the Upstart service provider for my ......
Read more >Modules — testinfra 7.0.2.dev1+gfc4bfd1.d20221210 ...
Network namespaces can only be used if ip command is available because in this case, the module ... version: default 4 (iptables), optionally...
Read more >testing Archives - ericsysmin's DevOps Blog
I'd like to share with you another design in testing your Ansible collections, modules, playbooks, and roles. Molecule used to include a file...
Read more >service provider should default to upstart in RHEL6 and greater
In puppet, when osfamily = redhat,suse, the provider for the service type defaults to the redhat type, which uses chkconfig.
Read more >Molecule Documentation - Release 2.13.1 AUTHORS.rst
1 Providers can be bare-metal, virtual, cloud or containers. ... To start a service which requires systemd, configure molecule.yml with a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@codylane Thanks for the nod. These were the underlying motivations for my earlier comment:
My opinion may be in the minority. I’m curious to hear others’ thoughts on the matter.
It’s not a hard requirement and is left to the package maintainer but most package maintainers do adhere to security requirements. Not all service bootstrapping has to happen from init but those that do should 98% of the time always be started from as the
root
user to avoid problems. If the service shouldn’t be run as root, the service shouldsu
the affective user and spawn the service with that user.My point above only corresponds to this ticket which we are talking about a RHEL based distro that uses SysV startup scripts or Systemd. There are other init style based services with their own execution models but for the sake of this ticket and this potential bug, I feel that we should at the very least agree that anything service related through init or systemd should be invoked as
root
and make no other assumptions. Just my 2$. Feel free to disagree or provide different context.I’m happy to share any other ideas or things to try.
A different context of thought:
If I was going to do a refactor of this of any kind, I would be looking to see what Ansible and Salt do as @elliotweiser suggests. I also wonder if it would be possible without to much work to just piggy back off the core library of Ansible or Salt and take advantage of fact gathering, service management… etc. I have a feeling this would be a significant re-write/refactor however. I may even explore this on my own fork.