diff options
author | Lénaïc Huard <lenaic@lhuard.fr> | 2015-04-15 23:37:24 +0200 |
---|---|---|
committer | Lénaïc Huard <lenaic@lhuard.fr> | 2015-04-15 23:49:43 +0200 |
commit | b71037de41baf06889b7a875a0e8914f940ecc2a (patch) | |
tree | 87c3e89eec6823810e9c83b400e8862e62007245 /playbooks/libvirt | |
parent | 34326ef782bcba8632738a40d3948bb23a3915dc (diff) | |
download | openshift-b71037de41baf06889b7a875a0e8914f940ecc2a.tar.gz openshift-b71037de41baf06889b7a875a0e8914f940ecc2a.tar.bz2 openshift-b71037de41baf06889b7a875a0e8914f940ecc2a.tar.xz openshift-b71037de41baf06889b7a875a0e8914f940ecc2a.zip |
Make the error message checks locale proof
On a computer which has a locale set, the error messages look like this:
```
$ virsh net-info foo
erreur :impossible de récupérer le réseau « foo »
erreur :Réseau non trouvé : no network with matching name 'foo'
```
```
$ virsh pool-info foo
erreur :impossible de récupérer le pool « foo »
erreur :Pool de stockage introuvable : no storage pool with matching name 'foo'
```
The classical way to make those tests locale proof is to force a given locale.
Like this:
```
$ LANG=POSIX virsh net-info foo
error: failed to get network 'foo'
error: Réseau non trouvé : no network with matching name 'foo'
```
```
$ LANG=POSIX virsh pool-info foo
error: failed to get pool 'foo'
error: Pool de stockage introuvable : no storage pool with matching name 'foo'
```
It looks like the "Network not found" or "Storage pool not found" parts of the message
are generated by the `libvirtd` daemon and are not subject to the locale of the `virsh`
client.
The clean fix consists in patching `libvirt` so that `virsh` sends its locale to the
`libvirtd` daemon.
But in the mean time, it is safer to have our playbook match the part of the message
which is not subject to the daemon locale.
Diffstat (limited to 'playbooks/libvirt')
-rw-r--r-- | playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_network.yml | 2 | ||||
-rw-r--r-- | playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_storage_pool.yml | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_network.yml b/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_network.yml index a320e681e..3117d9edc 100644 --- a/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_network.yml +++ b/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_network.yml @@ -3,7 +3,7 @@ command: "virsh -c {{ libvirt_uri }} net-info {{ libvirt_network }}" register: net_info_result changed_when: False - failed_when: "net_info_result.rc != 0 and 'error: Network not found:' not in net_info_result.stderr" + failed_when: "net_info_result.rc != 0 and 'no network with matching name' not in net_info_result.stderr" - name: Create a temp directory for the template xml file command: "mktemp -d /tmp/openshift-ansible-XXXXXXX" diff --git a/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_storage_pool.yml b/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_storage_pool.yml index 817acb250..10715f2b5 100644 --- a/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_storage_pool.yml +++ b/playbooks/libvirt/openshift-cluster/tasks/configure_libvirt_storage_pool.yml @@ -16,7 +16,7 @@ command: "virsh -c {{ libvirt_uri }} pool-info {{ libvirt_storage_pool }}" register: pool_info_result changed_when: False - failed_when: "pool_info_result.rc != 0 and 'error: Storage pool not found:' not in pool_info_result.stderr" + failed_when: "pool_info_result.rc != 0 and 'no storage pool with matching name' not in pool_info_result.stderr" - name: Create the libvirt storage pool for openshift command: 'virsh -c {{ libvirt_uri }} pool-create-as {{ libvirt_storage_pool }} dir --target {{ libvirt_storage_pool_path }}' |