Skip to content

Commit ec07ba2

Browse files
committed
tidy up
Signed-off-by: Chris Snow <[email protected]>
1 parent b084b98 commit ec07ba2

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

bin/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ def version(debug=False):
393393
if debug:
394394
print("HPECP Bin Path: " + os.path.dirname(os.path.abspath(__file__)))
395395
print(
396-
"HPECP Lib Path: " + os.path.dirname(os.path.abspath(hpecp.__file__))
396+
"HPECP Lib Path: "
397+
+ os.path.dirname(os.path.abspath(hpecp.__file__))
397398
)
398399
print("Python Version: " + sys.version.replace("\n", ""))
399400
print("Python Exe Path: " + sys.executable)

hpecp/cli/k8scluster.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,18 +368,26 @@ def import_generic_cluster_with_json(
368368
------
369369
APIException
370370
"""
371-
# assert (
372-
# json_file_path is not None or json_content is not None
373-
# ), "Either --json-file-path or --json-content must be provided."
371+
assert (
372+
json_file_path is not None or json_content is not None
373+
), "Either --json-file-path or --json-content must be provided"
374374

375-
# assert (
376-
# json_file_path is None and json_content is None
377-
# ), "Either --json-file-path or --json-content must be provided."
375+
assert (
376+
json_file_path is None or json_content is None
377+
), "Either --json-file-path or --json-content must be provided."
378378

379379
if json_file_path:
380-
# TODO verify file exist, etc
381-
with open(json_file_path, "r") as f:
382-
json_content = f.read()
380+
try:
381+
with open(json_file_path, "r") as f:
382+
json_content = f.read()
383+
except OSError:
384+
print(
385+
"Could not open/read json-file-path: {}".format(
386+
json_file_path
387+
),
388+
file=sys.stderr,
389+
)
390+
sys.exit(1)
383391

384392
json_content = json.loads(json_content)
385393

hpecp/datatap.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,23 @@ def create_hdfs_with_kerberos(
153153
[description]
154154
keytab : [type]
155155
[description]
156-
service_id : [type]
157-
[description]
158156
backup_host : [type]
159157
[description]
160-
endpoint_type : [type]
158+
type : [type]
161159
[description]
162-
endpoint_port : [type]
160+
port : [type]
163161
[description]
164162
read_only : [type]
165163
[description]
166164
"""
167165
_data = {
168-
"bdfs_root": {
169-
#"path_from_endpoint": path_from_endpoint
170-
},
166+
"bdfs_root": {},
171167
"endpoint": {
172168
"kdc_data": [
173169
{
174-
"host": kdc_data_host,
175-
#"port": kdc_data_port
176-
}
177-
],
170+
"host": kdc_data_host,
171+
}
172+
],
178173
"realm": realm,
179174
"client_principal": client_principal,
180175
"browse_only": browse_only,
@@ -188,16 +183,13 @@ def create_hdfs_with_kerberos(
188183
"flags": {"read_only": read_only},
189184
"label": {"name": name, "description": description},
190185
}
191-
186+
192187
if path_from_endpoint != "":
193188
_data["bdfs_root"]["path_from_endpoint"] = path_from_endpoint
194189

195190
if kdc_data_port != "":
196191
_data["endpoint"]["kdc_data"]["kdc_data_port"] = kdc_data_port
197192

198-
#if keytab != "":
199-
# _data["endpoint"]["keytab"] = keytab
200-
201193
self.client._request(
202194
url=DatatapController.base_resource_path,
203195
http_method="post",

0 commit comments

Comments
 (0)