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

Hi

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: [172.19.4.42]: 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’172.19.3.40’, u’172.19.3.41’, u’172.19.4.33’, u’172.19.4.35’, u’172.19.4.36’, u’172.19.4.37’, u’172.19.4.41’, u’172.19.4.42’, $‘172.19.4.43’], 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’,
u’INACTIVITY_TIMEOUT’: 20160, u’COUCH_CACHE_VIEWS’: True}’.
**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.

Fixed!

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

minio_server_datadirs:
- /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!!