Update-config: Failed at task `commcarehq : copy localsettings`


i was trying to run a command cchq echis update-config

The following error has been shown during the process.

TASK [commcarehq : copy localsettings] ********************************************************************************************fatal: []: FAILED! => {“changed”: false, “msg”: “AnsibleError: An unhandled exception occurred while templating ‘{u’ENFORCE_TWO_FACTOR_FOR_SUPERUSERS’: False, u’EMAIL_SMTP_HOST’: u’smtp.gmail.com’, u’HQ_INSTANCE’: u’echis’, u’SENTRY_ORGANIZATION_SLUG’: u’org slug’, u’REDIS_PORT’: u’6379’, u’COMMCARE_HQ_NAME’: u’eCHIS Portal’, u’cchq_bug_report_email’: u’echismoh@moh.gov.et’, u’E$ABLE_SOFT_ASSERT_EMAILS’: False, u’STATIC_ROOT’: None, u’EMAIL_SMTP_PORT’: 587, u’ENABLE_PRELOGIN_SITE’: False, u’STATIC_TOGGLE_ST$TES’: {u’mobile_ucr_linked_domain’: {u’always_enabled’: [u’fmoh-echis-staging’]}}, u’SENTRY_REPOSITORY’: u’fmoh’, u’ALLOWED_HOSTS’$ [u’’, u’’, u’’, u’’, u’’, u’’, u’’, u’’, $‘’], u’COUCH_CACHE_DOCS’: True, u’minio_server_datadirs’: [u’/usr/local/share/minio’], u’RESTRICT_DOMAIN_CREATION’: Tru$, u’COMMCARE_NAME’: u’eCHIS’, u’WS4REDIS_CONNECTION_HOST’: u’{{ groups.redis.0 }}’, u’REMINDERS_QUEUE_ENABLED’: True, u’SMS_QUEUE_$
NABLED’: True, u’IS_DIMAGI_ENVIRONMENT’: False, u’REDIS_HOST’: u’{{ groups.redis.0 }}’, u’REDIS_DB’: u’0’, u’minio_server_cluster_$
odes’: u”{{ groups[‘minio’]|map(‘string_prefix’, ‘/usr/local/share/minio’)|map(‘string_postfix’, ‘http://’)|list }}", u’ENTERPRI$
E_MODE’: True, u’EMAIL_USE_TLS’: True, u’DEPLOY_MACHINE_NAME’: u’{{ ansible_hostname }}’, u’SENTRY_PROJECT_SLUG’: u’project slug’,
**Error was a <class ‘jinja2.exceptions.TemplateRuntimeError’>, original **
message: no filter named ‘string_prefix’"}

Hi Demisew

I don’t see the use of string_prefix anywhere in commcare-cloud. Are you using a custom branch?

Hi Simon,

no am on the master branch and continuously updating(git fetch and merge) from dimagi cloud.

It looks like you’re on a fork of commcare-cloud which may have modifications to it that aren’t in the Dimagi repo.


there was some custom configuration added in public.yml file.

- /usr/local/share/minio
minio_server_cluster_nodes: "{{ groups['minio']|map('string_prefix',
'/usr/local/share/minio')|map('string_postfix', 'http://')|list }}"

It works after I removed those lines.

Are you using minio? If you are then I think those might be required.

ya, yes we are using minio
this config is creating an issue.
minio_server_cluster_nodes: "{{ groups['minio']|map('string_prefix', '/usr/local/share/minio')|map('string_postfix', 'http://')|list }}"

You could try this:

minio_server_cluster_nodes: "{{ ['http://'] | product(groups['minio']) | map('join', '') | product(['/usr/local/share/minio']) | map('join', '') | list }}"
1 Like

Hi Simon,

It works, thank you!!