Open
Description
While trying to build a reproducer for an issue I had in a customer deployment, I stumbled upon this:
# environments/test/environment.cfg
[environment]
host_domain = fcio.net
service_user = s-myservice
platform = nixos
update_method = rsync
branch = master
jobs = 3
[host:test42]
components =
service
wordpresscron
anothercomponent
[host:test68]
components =
maintenancepage
# components/repro/component.py
from batou.component import Component
import batou
class Service(Component):
def configure(self):
self.provide("service", self)
batou.output.annotate("Service component")
class WordpressCron(Component):
def configure(self):
self.provide("wordpress:cron", self)
batou.output.annotate("WP cron")
self.require_one("service", host=self.host)
class AnotherComponent(Component):
def configure(self):
self.require("wordpress:cron")
batou.output.annotate("placeholder")
class MaintenancePage(Component):
def configure(self):
self.require("wordpress:cron", reverse=True, strict=False, host=self.host)
With batou
2.5.2 I now get the following error:
$ ./batou deploy -P test
batou/2.5.2 (cpython 3.11.9-final0, Darwin 24.2.0 arm64)
============================================================= Preparing =============================================================
main: Loading environment `test`...
main: Verifying repository ...
You are using rsync. This is a non-verifying repository -- continuing on your own risk!
main: Loading secrets ...
============================================ Connecting hosts and configuring model ... =============================================
test42: Connecting via ssh (1/2)
test68: Connecting via ssh (2/2)
Service component
WP cron
placeholder
placeholder
Service component
WP cron
placeholder
placeholder
ERROR: Unsatisfied resource requirements
Resource "wordpress:cron" on "test68" required by anothercomponent
ERROR: 1 remaining unconfigured component(s): anothercomponent
================================================== 2 ERRORS - CONFIGURATION FAILED ==================================================
=========================================== DEPLOYMENT PREDICTION FAILED (during connect) ===========================================
I don't see anything that's obviously wrong with the code above.
Now, after doing
diff --git a/components/repro/component.py b/components/repro/component.py
index e4cf9bd..7997793 100644
--- a/components/repro/component.py
+++ b/components/repro/component.py
@@ -23,4 +23,5 @@ class AnotherComponent(Component):
class MaintenancePage(Component):
def configure(self):
- self.require("wordpress:cron", reverse=True, strict=False, host=self.host)
+ #self.require("wordpress:cron", reverse=True, strict=False, host=self.host)
+ pass
The error disappeared, the prediction is passing.
Am I holding it wrong? I don't expect a requirement with strict=False
to fail the requirement in another component.
Metadata
Metadata
Assignees
Labels
No labels