Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ esctl cluster routing allocation enable none
## Key Features

* **Easy to use CLI** rather than long curl commands (thanks to [cliff](https://github.com/openstack/cliff))
* Cluster-level informations : **stats**, **info**, **health**, **allocation explanation**
* Node-level informations : **list**, **hot threads**, **exclusion**, **stats**
* Cluster-level information : **stats**, **info**, **health**, **allocation explanation**
* Node-level information : **list**, **hot threads**, **exclusion**, **stats**
* Cluster-level and index-level **settings**
* `_cat` API for **allocation**, **plugins** and **thread pools**
* **Index management** : open, close, create, delete, list
Expand Down
2 changes: 1 addition & 1 deletion esctl/cmd/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def transform(self, allocation):


class CatPlugins(EsctlLister):
"""Returns informations about installed plugins across nodes."""
"""Returns information about installed plugins across nodes."""

def take_action(self, parsed_args):
plugins = self.transform(self.es.cat.plugins(format="json"))
Expand Down
2 changes: 1 addition & 1 deletion esctl/cmd/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def take_action(self, parsed_args):


class ClusterInfo(EsctlShowOne):
"""Show basic informations about the cluster."""
"""Show basic information about the cluster."""

def take_action(self, parsed_args):
infos = self.es.info()
Expand Down
4 changes: 2 additions & 2 deletions esctl/cmd/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def take_action(self, parsed_args):
)

def convert_timestamp_in_ms_to_human_readable(self, time_in_ms: int) -> str:
miliseconds = str(round((time_in_ms / 1000) % 1, 3)).split(".")[1]
milliseconds = str(round((time_in_ms / 1000) % 1, 3)).split(".")[1]
return (
datetime.datetime.utcfromtimestamp(time_in_ms / 1000).strftime(
"%Y-%m-%d %H:%M:%S"
)
+ f".{miliseconds}"
+ f".{milliseconds}"
)

def transform(self, nodes):
Expand Down
2 changes: 1 addition & 1 deletion esctl/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def objects_list_to_flat_dict(self, lst: list[dict[str, Any]]) -> dict[str, Any]
def _delete_and_merge_inner_dict_into_parent(
self, parent_dict: dict[str, Any], key: str
) -> dict[str, Any]:
"""Merge a inner dictionnary into it's parent.
"""Merge a inner dictionary into it's parent.

:Example:
{
Expand Down
4 changes: 2 additions & 2 deletions esctl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def load_configuration(self, path: str = "~/.esctlrc") -> OrderedDict:

return raw_config_file

def get_context_informations(self, context_name: str):
def get_context_information(self, context_name: str):
raw_context = self.contexts.get(context_name)
user = self.users.get(raw_context.get("user"))
cluster = self.clusters.get(raw_context.get("cluster"))
Expand Down Expand Up @@ -240,7 +240,7 @@ def create_context(self, context_name: str = None) -> Context:
self.log.debug("No context provided. Using default context")

try:
context = self.get_context_informations(context_name)
context = self.get_context_information(context_name)
self.log.debug(context)
except AttributeError:
self.log.fatal(f"Cannot load context '{context_name}'.")
Expand Down
22 changes: 11 additions & 11 deletions esctl/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@ def _format_special_word(self, word: str) -> str:
return word

def _split_string(self, string: str) -> list[str]:
splitted_string: list[str]
split_string: list[str]

if "." in string:
splitted_string = string.split(".")
split_string = string.split(".")

# Check if words can also be splitted on underscores
for idx in range(len(splitted_string)):
# Check if words can also be split on underscores
for idx in range(len(split_string)):
# If there is an underscore anywhere in the word except at the beginning
if "_" in splitted_string[idx] and not splitted_string[idx].startswith(
if "_" in split_string[idx] and not split_string[idx].startswith(
"_"
):
splitted_string[idx] = splitted_string[idx].split("_")
split_string[idx] = split_string[idx].split("_")

flat_list = []
for sublist in splitted_string:
for sublist in split_string:
if sublist.__class__.__name__ == "list":
for item in sublist:
flat_list.append(item)
else:
flat_list.append(sublist)

splitted_string = flat_list
split_string = flat_list

elif "_" in string:
splitted_string = string.split("_")
split_string = string.split("_")

else:
splitted_string = [string]
split_string = [string]

return splitted_string
return split_string

def _create_name_from_id(self, pretty_key=True):
"""Extrapolate the column's name based on its ID."""
Expand Down
2 changes: 1 addition & 1 deletion esctl/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def default(self, line):
ret = self.parent_app.run_subcommand(line_parts)
if self.errexit:
# Only provide this if errexit is enabled,
# otherise keep old behaviour
# otherwise keep old behaviour
return ret

def completenames(self, text, line, begidx, endidx):
Expand Down
8 changes: 4 additions & 4 deletions esctl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def configure_logging(self):
return

def insert_password_into_context(self):
external_passowrd_definition = self.context.user.get("external_password")
external_password_definition = self.context.user.get("external_password")
del self.context.user["external_password"]

if "command" in external_passowrd_definition:
if "run" in external_passowrd_definition.get("command"):
if "command" in external_password_definition:
if "run" in external_password_definition.get("command"):
self.context.user["password"] = self._run_os_system_command(
external_passowrd_definition.get("command").get("run")
external_password_definition.get("command").get("run")
)

def initialize_app(self, argv):
Expand Down