We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[dashboard] should be exposed via ingress
When running microk8s on the server, rather than doing port forwarding it should be possible to access the dashboard via ingress (similar to kubeflow dashboard)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scripts/wrappers/status.py`
Content:
```
1 #!/usr/bin/python3
2 import os
3 import argparse
4 
5 from common.utils import (
6     exit_if_no_permission,
7     exit_if_stopped,
8     is_cluster_locked,
9     is_ha_enabled,
10     get_dqlite_info,
11     wait_for_ready,
12     is_cluster_ready,
13     get_available_addons,
14     get_current_arch,
15     get_addon_by_name,
16     kubectl_get,
17     kubectl_get_clusterroles,
18 )
19 
20 
21 def is_enabled(addon, item):
22     if addon in item:
23         return True
24     else:
25         filepath = os.path.expandvars(addon)
26         return os.path.isfile(filepath)
27 
28     return False
29 
30 
31 def print_short(isReady, enabled_addons, disabled_addons):
32     if isReady:
33         print("microk8s is running")
34         print("addons:")
35         if enabled_addons and len(enabled_addons) > 0:
36             for enabled in enabled_addons:
37                 print("{}: enabled".format(enabled["name"]))
38         if disabled_addons and len(disabled_addons) > 0:
39             for disabled in disabled_addons:
40                 print("{}: disabled".format(disabled["name"]))
41     else:
42         print("microk8s is not running. Use microk8s inspect for a deeper inspection.")
43 
44 
45 def print_pretty(isReady, enabled_addons, disabled_addons):
46     console_formatter = "{:>3} {:<20} # {}"
47     if isReady:
48         print("microk8s is running")
49         if not is_ha_enabled():
50             print("high-availability: no")
51         else:
52             info = get_dqlite_info()
53             if ha_cluster_formed(info):
54                 print("high-availability: yes")
55             else:
56                 print("high-availability: no")
57 
58             masters = "none"
59             standby = "none"
60             for node in info:
61                 if node[1] == "voter":
62                     if masters == "none":
63                         masters = "{}".format(node[0])
64                     else:
65                         masters = "{} {}".format(masters, node[0])
66                 if node[1] == "standby":
67                     if standby == "none":
68                         standby = "{}".format(node[0])
69                     else:
70                         standby = "{} {}".format(standby, node[0])
71 
72             print("{:>2}{} {}".format("", "datastore master nodes:", masters))
73             print("{:>2}{} {}".format("", "datastore standby nodes:", standby))
74 
75         print("addons:")
76         if enabled_addons and len(enabled_addons) > 0:
77             print("{:>2}{}".format("", "enabled:"))
78             for enabled in enabled_addons:
79                 print(console_formatter.format("", enabled["name"], enabled["description"]))
80         if disabled_addons and len(disabled_addons) > 0:
81             print("{:>2}{}".format("", "disabled:"))
82             for disabled in disabled_addons:
83                 print(console_formatter.format("", disabled["name"], disabled["description"]))
84     else:
85         print("microk8s is not running. Use microk8s inspect for a deeper inspection.")
86 
87 
88 def print_short_yaml(isReady, enabled_addons, disabled_addons):
89     print("microk8s:")
90     print("{:>2}{} {}".format("", "running:", isReady))
91 
92     if isReady:
93         print("addons:")
94         for enabled in enabled_addons:
95             print("  {}: enabled".format(enabled["name"]))
96 
97         for disabled in disabled_addons:
98             print("  {}: disabled".format(disabled["name"]))
99     else:
100         print(
101             "{:>2}{} {}".format(
102                 "",
103                 "message:",
104                 "microk8s is not running. Use microk8s inspect for a deeper inspection.",
105             )
106         )
107 
108 
109 def print_yaml(isReady, enabled_addons, disabled_addons):
110     print("microk8s:")
111     print("{:>2}{} {}".format("", "running:", isReady))
112 
113     print("{:>2}".format("high-availability:"))
114     ha_enabled = is_ha_enabled()
115     print("{:>2}{} {}".format("", "enabled:", ha_enabled))
116     if ha_enabled:
117         info = get_dqlite_info()
118         print("{:>2}{}".format("", "nodes:"))
119         for node in info:
120             print("{:>6}address: {:<1}".format("- ", node[0]))
121             print("{:>6}role: {:<1}".format("", node[1]))
122 
123     if isReady:
124         print("{:>2}".format("addons:"))
125         for enabled in enabled_addons:
126             print("{:>4}name: {:<1}".format("- ", enabled["name"]))
127             print("{:>4}description: {:<1}".format("", enabled["description"]))
128             print("{:>4}version: {:<1}".format("", enabled["version"]))
129             print("{:>4}status: enabled".format(""))
130 
131         for disabled in disabled_addons:
132             print("{:>4}name: {:<1}".format("- ", disabled["name"]))
133             print("{:>4}description: {:<1}".format("", disabled["description"]))
134             print("{:>4}version: {:<1}".format("", disabled["version"]))
135             print("{:>4}status: disabled".format(""))
136     else:
137         print(
138             "{:>2}{} {}".format(
139                 "",
140                 "message:",
141                 "microk8s is not running. Use microk8s inspect for a deeper inspection.",
142             )
143         )
144 
145 
146 def print_addon_status(enabled):
147     if len(enabled) > 0:
148         print("enabled")
149     else:
150         print("disabled")
151 
152 
153 def get_status(available_addons, isReady):
154     enabled = []
155     disabled = []
156     if isReady:
157         kube_output = kubectl_get("all")
158         cluster_output = kubectl_get_clusterroles()
159         kube_output = kube_output + cluster_output
160         for addon in available_addons:
161             found = False
162             for row in kube_output.split("\n"):
163                 if is_enabled(addon["check_status"], row):
164                     enabled.append(addon)
165                     found = True
166                     break
167             if not found:
168                 disabled.append(addon)
169 
170     return enabled, disabled
171 
172 
173 def ha_cluster_formed(info):
174     voters = 0
175     for node in info:
176         if node[1] == "voter":
177             voters += 1
178     ha_formed = False
179     if voters > 2:
180         ha_formed = True
181     return ha_formed
182 
183 
184 if __name__ == "__main__":
185     exit_if_no_permission()
186     exit_if_stopped()
187     is_cluster_locked()
188 
189     # initiate the parser with a description
190     parser = argparse.ArgumentParser(
191         description="Microk8s cluster status check.", prog="microk8s status"
192     )
193     parser.add_argument(
194         "--format",
195         help="print cluster and addon status, output can be in yaml, pretty or short",
196         default="pretty",
197         choices={"pretty", "yaml", "short"},
198     )
199     parser.add_argument(
200         "-w", "--wait-ready", action="store_true", help="wait until the cluster is in ready state"
201     )
202     parser.add_argument(
203         "-t",
204         "--timeout",
205         help="specify a timeout in seconds when waiting for the cluster to be ready.",
206         type=int,
207         default=0,
208     )
209     parser.add_argument("-a", "--addon", help="check the status of an addon.", default="all")
210     parser.add_argument(
211         "--yaml", action="store_true", help="DEPRECATED, use '--format yaml' instead"
212     )
213 
214     # read arguments from the command line
215     args = parser.parse_args()
216 
217     wait_ready = args.wait_ready
218     timeout = args.timeout
219     yaml_short = args.yaml
220 
221     if wait_ready:
222         isReady = wait_for_ready(timeout)
223     else:
224         isReady = is_cluster_ready()
225 
226     available_addons = get_available_addons(get_current_arch())
227 
228     if args.addon != "all":
229         available_addons = get_addon_by_name(available_addons, args.addon)
230 
231     enabled, disabled = get_status(available_addons, isReady)
232 
233     if args.addon != "all":
234         print_addon_status(enabled)
235     else:
236         if args.format == "yaml":
237             print_yaml(isReady, enabled, disabled)
238         elif args.format == "short":
239             print_short(isReady, enabled, disabled)
240         else:
241             if yaml_short:
242                 print_short_yaml(isReady, enabled, disabled)
243             else:
244                 print_pretty(isReady, enabled, disabled)
245
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scripts/wrappers/status.py b/scripts/wrappers/status.py
--- a/scripts/wrappers/status.py
+++ b/scripts/wrappers/status.py
@@ -154,7 +154,8 @@
     enabled = []
     disabled = []
     if isReady:
-        kube_output = kubectl_get("all")
+        # 'all' does not include ingress
+        kube_output = kubectl_get("all,ingress")
         cluster_output = kubectl_get_clusterroles()
         kube_output = kube_output + cluster_output
         for addon in available_addons:

{"golden_diff": "diff --git a/scripts/wrappers/status.py b/scripts/wrappers/status.py\n--- a/scripts/wrappers/status.py\n+++ b/scripts/wrappers/status.py\n@@ -154,7 +154,8 @@\n     enabled = []\n     disabled = []\n     if isReady:\n-        kube_output = kubectl_get(\"all\")\n+        # 'all' does not include ingress\n+        kube_output = kubectl_get(\"all,ingress\")\n         cluster_output = kubectl_get_clusterroles()\n         kube_output = kube_output + cluster_output\n         for addon in available_addons:\n", "issue": "[dashboard] should be exposed via ingress\nWhen running microk8s on the server, rather than doing port forwarding it should be possible to access the dashboard via ingress (similar to kubeflow dashboard)\n", "before_files": [{"content": "#!/usr/bin/python3\nimport os\nimport argparse\n\nfrom common.utils import (\n    exit_if_no_permission,\n    exit_if_stopped,\n    is_cluster_locked,\n    is_ha_enabled,\n    get_dqlite_info,\n    wait_for_ready,\n    is_cluster_ready,\n    get_available_addons,\n    get_current_arch,\n    get_addon_by_name,\n    kubectl_get,\n    kubectl_get_clusterroles,\n)\n\n\ndef is_enabled(addon, item):\n    if addon in item:\n        return True\n    else:\n        filepath = os.path.expandvars(addon)\n        return os.path.isfile(filepath)\n\n    return False\n\n\ndef print_short(isReady, enabled_addons, disabled_addons):\n    if isReady:\n        print(\"microk8s is running\")\n        print(\"addons:\")\n        if enabled_addons and len(enabled_addons) > 0:\n            for enabled in enabled_addons:\n                print(\"{}: enabled\".format(enabled[\"name\"]))\n        if disabled_addons and len(disabled_addons) > 0:\n            for disabled in disabled_addons:\n                print(\"{}: disabled\".format(disabled[\"name\"]))\n    else:\n        print(\"microk8s is not running. Use microk8s inspect for a deeper inspection.\")\n\n\ndef print_pretty(isReady, enabled_addons, disabled_addons):\n    console_formatter = \"{:>3} {:<20} # {}\"\n    if isReady:\n        print(\"microk8s is running\")\n        if not is_ha_enabled():\n            print(\"high-availability: no\")\n        else:\n            info = get_dqlite_info()\n            if ha_cluster_formed(info):\n                print(\"high-availability: yes\")\n            else:\n                print(\"high-availability: no\")\n\n            masters = \"none\"\n            standby = \"none\"\n            for node in info:\n                if node[1] == \"voter\":\n                    if masters == \"none\":\n                        masters = \"{}\".format(node[0])\n                    else:\n                        masters = \"{} {}\".format(masters, node[0])\n                if node[1] == \"standby\":\n                    if standby == \"none\":\n                        standby = \"{}\".format(node[0])\n                    else:\n                        standby = \"{} {}\".format(standby, node[0])\n\n            print(\"{:>2}{} {}\".format(\"\", \"datastore master nodes:\", masters))\n            print(\"{:>2}{} {}\".format(\"\", \"datastore standby nodes:\", standby))\n\n        print(\"addons:\")\n        if enabled_addons and len(enabled_addons) > 0:\n            print(\"{:>2}{}\".format(\"\", \"enabled:\"))\n            for enabled in enabled_addons:\n                print(console_formatter.format(\"\", enabled[\"name\"], enabled[\"description\"]))\n        if disabled_addons and len(disabled_addons) > 0:\n            print(\"{:>2}{}\".format(\"\", \"disabled:\"))\n            for disabled in disabled_addons:\n                print(console_formatter.format(\"\", disabled[\"name\"], disabled[\"description\"]))\n    else:\n        print(\"microk8s is not running. Use microk8s inspect for a deeper inspection.\")\n\n\ndef print_short_yaml(isReady, enabled_addons, disabled_addons):\n    print(\"microk8s:\")\n    print(\"{:>2}{} {}\".format(\"\", \"running:\", isReady))\n\n    if isReady:\n        print(\"addons:\")\n        for enabled in enabled_addons:\n            print(\"  {}: enabled\".format(enabled[\"name\"]))\n\n        for disabled in disabled_addons:\n            print(\"  {}: disabled\".format(disabled[\"name\"]))\n    else:\n        print(\n            \"{:>2}{} {}\".format(\n                \"\",\n                \"message:\",\n                \"microk8s is not running. Use microk8s inspect for a deeper inspection.\",\n            )\n        )\n\n\ndef print_yaml(isReady, enabled_addons, disabled_addons):\n    print(\"microk8s:\")\n    print(\"{:>2}{} {}\".format(\"\", \"running:\", isReady))\n\n    print(\"{:>2}\".format(\"high-availability:\"))\n    ha_enabled = is_ha_enabled()\n    print(\"{:>2}{} {}\".format(\"\", \"enabled:\", ha_enabled))\n    if ha_enabled:\n        info = get_dqlite_info()\n        print(\"{:>2}{}\".format(\"\", \"nodes:\"))\n        for node in info:\n            print(\"{:>6}address: {:<1}\".format(\"- \", node[0]))\n            print(\"{:>6}role: {:<1}\".format(\"\", node[1]))\n\n    if isReady:\n        print(\"{:>2}\".format(\"addons:\"))\n        for enabled in enabled_addons:\n            print(\"{:>4}name: {:<1}\".format(\"- \", enabled[\"name\"]))\n            print(\"{:>4}description: {:<1}\".format(\"\", enabled[\"description\"]))\n            print(\"{:>4}version: {:<1}\".format(\"\", enabled[\"version\"]))\n            print(\"{:>4}status: enabled\".format(\"\"))\n\n        for disabled in disabled_addons:\n            print(\"{:>4}name: {:<1}\".format(\"- \", disabled[\"name\"]))\n            print(\"{:>4}description: {:<1}\".format(\"\", disabled[\"description\"]))\n            print(\"{:>4}version: {:<1}\".format(\"\", disabled[\"version\"]))\n            print(\"{:>4}status: disabled\".format(\"\"))\n    else:\n        print(\n            \"{:>2}{} {}\".format(\n                \"\",\n                \"message:\",\n                \"microk8s is not running. Use microk8s inspect for a deeper inspection.\",\n            )\n        )\n\n\ndef print_addon_status(enabled):\n    if len(enabled) > 0:\n        print(\"enabled\")\n    else:\n        print(\"disabled\")\n\n\ndef get_status(available_addons, isReady):\n    enabled = []\n    disabled = []\n    if isReady:\n        kube_output = kubectl_get(\"all\")\n        cluster_output = kubectl_get_clusterroles()\n        kube_output = kube_output + cluster_output\n        for addon in available_addons:\n            found = False\n            for row in kube_output.split(\"\\n\"):\n                if is_enabled(addon[\"check_status\"], row):\n                    enabled.append(addon)\n                    found = True\n                    break\n            if not found:\n                disabled.append(addon)\n\n    return enabled, disabled\n\n\ndef ha_cluster_formed(info):\n    voters = 0\n    for node in info:\n        if node[1] == \"voter\":\n            voters += 1\n    ha_formed = False\n    if voters > 2:\n        ha_formed = True\n    return ha_formed\n\n\nif __name__ == \"__main__\":\n    exit_if_no_permission()\n    exit_if_stopped()\n    is_cluster_locked()\n\n    # initiate the parser with a description\n    parser = argparse.ArgumentParser(\n        description=\"Microk8s cluster status check.\", prog=\"microk8s status\"\n    )\n    parser.add_argument(\n        \"--format\",\n        help=\"print cluster and addon status, output can be in yaml, pretty or short\",\n        default=\"pretty\",\n        choices={\"pretty\", \"yaml\", \"short\"},\n    )\n    parser.add_argument(\n        \"-w\", \"--wait-ready\", action=\"store_true\", help=\"wait until the cluster is in ready state\"\n    )\n    parser.add_argument(\n        \"-t\",\n        \"--timeout\",\n        help=\"specify a timeout in seconds when waiting for the cluster to be ready.\",\n        type=int,\n        default=0,\n    )\n    parser.add_argument(\"-a\", \"--addon\", help=\"check the status of an addon.\", default=\"all\")\n    parser.add_argument(\n        \"--yaml\", action=\"store_true\", help=\"DEPRECATED, use '--format yaml' instead\"\n    )\n\n    # read arguments from the command line\n    args = parser.parse_args()\n\n    wait_ready = args.wait_ready\n    timeout = args.timeout\n    yaml_short = args.yaml\n\n    if wait_ready:\n        isReady = wait_for_ready(timeout)\n    else:\n        isReady = is_cluster_ready()\n\n    available_addons = get_available_addons(get_current_arch())\n\n    if args.addon != \"all\":\n        available_addons = get_addon_by_name(available_addons, args.addon)\n\n    enabled, disabled = get_status(available_addons, isReady)\n\n    if args.addon != \"all\":\n        print_addon_status(enabled)\n    else:\n        if args.format == \"yaml\":\n            print_yaml(isReady, enabled, disabled)\n        elif args.format == \"short\":\n            print_short(isReady, enabled, disabled)\n        else:\n            if yaml_short:\n                print_short_yaml(isReady, enabled, disabled)\n            else:\n                print_pretty(isReady, enabled, disabled)\n", "path": "scripts/wrappers/status.py"}], "after_files": [{"content": "#!/usr/bin/python3\nimport os\nimport argparse\n\nfrom common.utils import (\n    exit_if_no_permission,\n    exit_if_stopped,\n    is_cluster_locked,\n    is_ha_enabled,\n    get_dqlite_info,\n    wait_for_ready,\n    is_cluster_ready,\n    get_available_addons,\n    get_current_arch,\n    get_addon_by_name,\n    kubectl_get,\n    kubectl_get_clusterroles,\n)\n\n\ndef is_enabled(addon, item):\n    if addon in item:\n        return True\n    else:\n        filepath = os.path.expandvars(addon)\n        return os.path.isfile(filepath)\n\n    return False\n\n\ndef print_short(isReady, enabled_addons, disabled_addons):\n    if isReady:\n        print(\"microk8s is running\")\n        print(\"addons:\")\n        if enabled_addons and len(enabled_addons) > 0:\n            for enabled in enabled_addons:\n                print(\"{}: enabled\".format(enabled[\"name\"]))\n        if disabled_addons and len(disabled_addons) > 0:\n            for disabled in disabled_addons:\n                print(\"{}: disabled\".format(disabled[\"name\"]))\n    else:\n        print(\"microk8s is not running. Use microk8s inspect for a deeper inspection.\")\n\n\ndef print_pretty(isReady, enabled_addons, disabled_addons):\n    console_formatter = \"{:>3} {:<20} # {}\"\n    if isReady:\n        print(\"microk8s is running\")\n        if not is_ha_enabled():\n            print(\"high-availability: no\")\n        else:\n            info = get_dqlite_info()\n            if ha_cluster_formed(info):\n                print(\"high-availability: yes\")\n            else:\n                print(\"high-availability: no\")\n\n            masters = \"none\"\n            standby = \"none\"\n            for node in info:\n                if node[1] == \"voter\":\n                    if masters == \"none\":\n                        masters = \"{}\".format(node[0])\n                    else:\n                        masters = \"{} {}\".format(masters, node[0])\n                if node[1] == \"standby\":\n                    if standby == \"none\":\n                        standby = \"{}\".format(node[0])\n                    else:\n                        standby = \"{} {}\".format(standby, node[0])\n\n            print(\"{:>2}{} {}\".format(\"\", \"datastore master nodes:\", masters))\n            print(\"{:>2}{} {}\".format(\"\", \"datastore standby nodes:\", standby))\n\n        print(\"addons:\")\n        if enabled_addons and len(enabled_addons) > 0:\n            print(\"{:>2}{}\".format(\"\", \"enabled:\"))\n            for enabled in enabled_addons:\n                print(console_formatter.format(\"\", enabled[\"name\"], enabled[\"description\"]))\n        if disabled_addons and len(disabled_addons) > 0:\n            print(\"{:>2}{}\".format(\"\", \"disabled:\"))\n            for disabled in disabled_addons:\n                print(console_formatter.format(\"\", disabled[\"name\"], disabled[\"description\"]))\n    else:\n        print(\"microk8s is not running. Use microk8s inspect for a deeper inspection.\")\n\n\ndef print_short_yaml(isReady, enabled_addons, disabled_addons):\n    print(\"microk8s:\")\n    print(\"{:>2}{} {}\".format(\"\", \"running:\", isReady))\n\n    if isReady:\n        print(\"addons:\")\n        for enabled in enabled_addons:\n            print(\"  {}: enabled\".format(enabled[\"name\"]))\n\n        for disabled in disabled_addons:\n            print(\"  {}: disabled\".format(disabled[\"name\"]))\n    else:\n        print(\n            \"{:>2}{} {}\".format(\n                \"\",\n                \"message:\",\n                \"microk8s is not running. Use microk8s inspect for a deeper inspection.\",\n            )\n        )\n\n\ndef print_yaml(isReady, enabled_addons, disabled_addons):\n    print(\"microk8s:\")\n    print(\"{:>2}{} {}\".format(\"\", \"running:\", isReady))\n\n    print(\"{:>2}\".format(\"high-availability:\"))\n    ha_enabled = is_ha_enabled()\n    print(\"{:>2}{} {}\".format(\"\", \"enabled:\", ha_enabled))\n    if ha_enabled:\n        info = get_dqlite_info()\n        print(\"{:>2}{}\".format(\"\", \"nodes:\"))\n        for node in info:\n            print(\"{:>6}address: {:<1}\".format(\"- \", node[0]))\n            print(\"{:>6}role: {:<1}\".format(\"\", node[1]))\n\n    if isReady:\n        print(\"{:>2}\".format(\"addons:\"))\n        for enabled in enabled_addons:\n            print(\"{:>4}name: {:<1}\".format(\"- \", enabled[\"name\"]))\n            print(\"{:>4}description: {:<1}\".format(\"\", enabled[\"description\"]))\n            print(\"{:>4}version: {:<1}\".format(\"\", enabled[\"version\"]))\n            print(\"{:>4}status: enabled\".format(\"\"))\n\n        for disabled in disabled_addons:\n            print(\"{:>4}name: {:<1}\".format(\"- \", disabled[\"name\"]))\n            print(\"{:>4}description: {:<1}\".format(\"\", disabled[\"description\"]))\n            print(\"{:>4}version: {:<1}\".format(\"\", disabled[\"version\"]))\n            print(\"{:>4}status: disabled\".format(\"\"))\n    else:\n        print(\n            \"{:>2}{} {}\".format(\n                \"\",\n                \"message:\",\n                \"microk8s is not running. Use microk8s inspect for a deeper inspection.\",\n            )\n        )\n\n\ndef print_addon_status(enabled):\n    if len(enabled) > 0:\n        print(\"enabled\")\n    else:\n        print(\"disabled\")\n\n\ndef get_status(available_addons, isReady):\n    enabled = []\n    disabled = []\n    if isReady:\n        # 'all' does not include ingress\n        kube_output = kubectl_get(\"all,ingress\")\n        cluster_output = kubectl_get_clusterroles()\n        kube_output = kube_output + cluster_output\n        for addon in available_addons:\n            found = False\n            for row in kube_output.split(\"\\n\"):\n                if is_enabled(addon[\"check_status\"], row):\n                    enabled.append(addon)\n                    found = True\n                    break\n            if not found:\n                disabled.append(addon)\n\n    return enabled, disabled\n\n\ndef ha_cluster_formed(info):\n    voters = 0\n    for node in info:\n        if node[1] == \"voter\":\n            voters += 1\n    ha_formed = False\n    if voters > 2:\n        ha_formed = True\n    return ha_formed\n\n\nif __name__ == \"__main__\":\n    exit_if_no_permission()\n    exit_if_stopped()\n    is_cluster_locked()\n\n    # initiate the parser with a description\n    parser = argparse.ArgumentParser(\n        description=\"Microk8s cluster status check.\", prog=\"microk8s status\"\n    )\n    parser.add_argument(\n        \"--format\",\n        help=\"print cluster and addon status, output can be in yaml, pretty or short\",\n        default=\"pretty\",\n        choices={\"pretty\", \"yaml\", \"short\"},\n    )\n    parser.add_argument(\n        \"-w\", \"--wait-ready\", action=\"store_true\", help=\"wait until the cluster is in ready state\"\n    )\n    parser.add_argument(\n        \"-t\",\n        \"--timeout\",\n        help=\"specify a timeout in seconds when waiting for the cluster to be ready.\",\n        type=int,\n        default=0,\n    )\n    parser.add_argument(\"-a\", \"--addon\", help=\"check the status of an addon.\", default=\"all\")\n    parser.add_argument(\n        \"--yaml\", action=\"store_true\", help=\"DEPRECATED, use '--format yaml' instead\"\n    )\n\n    # read arguments from the command line\n    args = parser.parse_args()\n\n    wait_ready = args.wait_ready\n    timeout = args.timeout\n    yaml_short = args.yaml\n\n    if wait_ready:\n        isReady = wait_for_ready(timeout)\n    else:\n        isReady = is_cluster_ready()\n\n    available_addons = get_available_addons(get_current_arch())\n\n    if args.addon != \"all\":\n        available_addons = get_addon_by_name(available_addons, args.addon)\n\n    enabled, disabled = get_status(available_addons, isReady)\n\n    if args.addon != \"all\":\n        print_addon_status(enabled)\n    else:\n        if args.format == \"yaml\":\n            print_yaml(isReady, enabled, disabled)\n        elif args.format == \"short\":\n            print_short(isReady, enabled, disabled)\n        else:\n            if yaml_short:\n                print_short_yaml(isReady, enabled, disabled)\n            else:\n                print_pretty(isReady, enabled, disabled)\n", "path": "scripts/wrappers/status.py"}]}