diff --git a/elastimorphic/management/commands/es_swap_aliases.py b/elastimorphic/management/commands/es_swap_aliases.py index 179861c..42d3255 100644 --- a/elastimorphic/management/commands/es_swap_aliases.py +++ b/elastimorphic/management/commands/es_swap_aliases.py @@ -23,13 +23,14 @@ def handle(self, index_suffix, **options): existing_aliases = es.indices.get_aliases() for index, aliases in existing_aliases.items(): for alias, new_index in indexes.items(): - if alias in aliases['aliases']: - alias_actions.append({ - "remove": { - "alias": alias, - "index": index - } - }) + if "aliases" in aliases: + if alias in aliases["aliases"]: + alias_actions.append({ + "remove": { + "alias": alias, + "index": index + } + }) # add our new aliases for alias, index in indexes.items(): alias_actions.append({ diff --git a/elastimorphic/management/commands/synces.py b/elastimorphic/management/commands/synces.py index 34d9fcf..0829977 100644 --- a/elastimorphic/management/commands/synces.py +++ b/elastimorphic/management/commands/synces.py @@ -39,7 +39,7 @@ def handle(self, *args, **options): index_suffix = "" aliases = es.indices.get_aliases() for index_name in aliases: - index_aliases = aliases[index_name]["aliases"] + index_aliases = aliases[index_name].get("aliases") if index_aliases: index_alias_map[index_aliases.keys()[0]] = index_name diff --git a/test_provision.sh b/test_provision.sh index 0909e37..174adae 100644 --- a/test_provision.sh +++ b/test_provision.sh @@ -1,7 +1,7 @@ # installs and fires up elasticsearch sudo sh -c "apt-get update -y" sudo sh -c "wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -" -sudo sh -c "echo deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main \ >> /etc/apt/sources.list" +sudo sh -c "echo deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main \ >> /etc/apt/sources.list" sudo sh -c "apt-get update -y" sudo sh -c "apt-get install -y openjdk-7-jre elasticsearch" sudo sh -c "update-rc.d elasticsearch defaults 95 10"