Skip to content

Commit 8cd4c97

Browse files
{NexusIdentity}: Add support for nexus identity for Linux OS. (Azure#8485)
* linux changes * linux changes - kushal's file * linux changes - kushal's file * Updated history , setup.py file and test recording * differentiate windows and linux paths * Update test_nexusidentity_scenario.py Make tests live_only --------- Co-authored-by: Kushal Gupta <[email protected]>
1 parent e8a0e25 commit 8cd4c97

File tree

5 files changed

+74
-22
lines changed

5 files changed

+74
-22
lines changed

src/nexusidentity/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
1.0.0b4
7+
+++++++
8+
* Adding support for Linux platform
9+
610
1.0.0b3
711
++++++
812
* Adding print statements to o/p creation & update of extensions.

src/nexusidentity/azext_nexusidentity/custom.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ def generate_nexus_identity_keys() -> None:
2828
from msgraph.generated.models.o_data_errors.o_data_error import ODataError
2929

3030
# Generate SSH key
31-
if sys.platform.startswith("win"):
31+
if sys.platform.startswith("win") or sys.platform.startswith("linux"):
3232

33-
dir_path = os.path.expanduser("~\\.ssh")
33+
if sys.platform.startswith("win"):
34+
dir_path = os.path.expanduser("~\\.ssh")
35+
elif sys.platform.startswith("linux"):
36+
dir_path = os.path.expanduser("~/.ssh")
3437

3538
# check if the ssh directory exists or not
3639
if not os.path.exists(dir_path):
@@ -122,4 +125,4 @@ async def me():
122125
asyncio.run(me())
123126
else:
124127
logger.warning(
125-
"This command is currently supported only on Windows platforms")
128+
"This command is currently supported only on Windows and linux platforms")

src/nexusidentity/azext_nexusidentity/tests/latest/recordings/test_nexusidentity_scenario1.yaml

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,82 @@ interactions:
1111
host:
1212
- graph.microsoft.com
1313
user-agent:
14-
- python-httpx/0.27.0
14+
- python-httpx/0.28.1
15+
method: GET
16+
uri: https://graph.microsoft.com/v1.0/users/me-token-to-replace
17+
response:
18+
body:
19+
string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users/$entity","businessPhones":[],"displayName":"Rishabh
20+
Puri","givenName":"Rishabh","jobTitle":"PRINCIPAL SWE MANAGER","mail":"[email protected]","mobilePhone":null,"officeLocation":"HYD
21+
CAMPUS 4/Mobile","preferredLanguage":null,"surname":"Puri","userPrincipalName":"[email protected]","id":"fa1b1940-caf0-45a5-b65b-aac7439f3691"}'
22+
headers:
23+
cache-control:
24+
- no-cache
25+
content-length:
26+
- '411'
27+
content-type:
28+
- application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
29+
date:
30+
- Tue, 18 Feb 2025 08:05:44 GMT
31+
odata-version:
32+
- '4.0'
33+
request-id:
34+
- 17da750e-e14e-4359-a235-5181637e8810
35+
strict-transport-security:
36+
- max-age=31536000
37+
vary:
38+
- Accept-Encoding
39+
x-ms-ags-diagnostic:
40+
- '{"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF000003AE"}}'
41+
x-ms-resource-unit:
42+
- '1'
43+
status:
44+
code: 200
45+
message: OK
46+
- request:
47+
body: ''
48+
headers:
49+
accept:
50+
- application/json
51+
accept-encoding:
52+
- gzip, deflate
53+
connection:
54+
- keep-alive
55+
host:
56+
- graph.microsoft.com
57+
user-agent:
58+
- python-httpx/0.28.1
1559
method: GET
1660
uri: https://graph.microsoft.com/v1.0/users/me-token-to-replace/extensions
1761
response:
1862
body:
19-
string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users(''40523ce8-82a4-4362-b93a-7dfd212edd4c'')/extensions","value":[{"@odata.type":"#microsoft.graph.openTypeExtension","extension_name":"com.nexusidentity.keys","publicKey":"[email protected]
20-
AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIJet7nknqBQpavVf6gjjjlcHUfckuGI4eZDJxG4tlSSHAAAABHNzaDo=
21-
fareast\\jtamma@DESKTOP-QDMRQ39\n","id":"com.nexusidentity.keys"}]}'
63+
string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users(''fa1b1940-caf0-45a5-b65b-aac7439f3691'')/extensions","value":[{"@odata.type":"#microsoft.graph.openTypeExtension","extension_name":"com.nexusidentity.keys","publicKey":"[email protected]
64+
AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAINdFNXac4qffKcuh/J50h267lZ/7J3HkB9jvl33/zae/AAAABHNzaDo=
65+
fareast\\rishabhpuri@RishabhPuriMsft\n","id":"com.nexusidentity.keys"}]}'
2266
headers:
2367
content-length:
24-
- '431'
68+
- '436'
2569
content-type:
2670
- application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
2771
date:
28-
- Mon, 03 Jun 2024 20:35:36 GMT
72+
- Tue, 18 Feb 2025 08:05:48 GMT
2973
odata-version:
3074
- '4.0'
3175
request-id:
32-
- 10fe3408-7303-4b72-baa2-428ee6dce930
76+
- a3ee98e5-b9ce-4a23-a56e-5c45c9eba89b
3377
strict-transport-security:
3478
- max-age=31536000
3579
vary:
3680
- Accept-Encoding
3781
x-ms-ags-diagnostic:
38-
- '{"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF000002CB"}}'
82+
- '{"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF000003AE"}}'
3983
status:
4084
code: 200
4185
message: OK
4286
- request:
4387
body: '{"@odata.type": "microsoft.graph.openTypeExtension", "extension_name":
44-
"com.nexusidentity.keys", "publicKey": "[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIJet7nknqBQpavVf6gjjjlcHUfckuGI4eZDJxG4tlSSHAAAABHNzaDo=
45-
fareast\\jtamma@DESKTOP-QDMRQ39\n"}'
88+
"com.nexusidentity.keys", "publicKey": "[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAINdFNXac4qffKcuh/J50h267lZ/7J3HkB9jvl33/zae/AAAABHNzaDo=
89+
fareast\\rishabhpuri@RishabhPuriMsft\n"}'
4690
headers:
4791
accept:
4892
- application/json
@@ -51,27 +95,27 @@ interactions:
5195
connection:
5296
- keep-alive
5397
content-length:
54-
- '274'
98+
- '279'
5599
content-type:
56100
- application/json
57101
host:
58102
- graph.microsoft.com
59103
user-agent:
60-
- python-httpx/0.27.0
104+
- python-httpx/0.28.1
61105
method: PATCH
62106
uri: https://graph.microsoft.com/v1.0/users/me-token-to-replace/extensions/com.nexusidentity.keys
63107
response:
64108
body:
65109
string: ''
66110
headers:
67111
date:
68-
- Mon, 03 Jun 2024 20:35:57 GMT
112+
- Tue, 18 Feb 2025 08:05:52 GMT
69113
request-id:
70-
- e5612a3d-5086-4e68-873d-7c8f4f5a573e
114+
- 6c947417-25c5-4bc7-bc7c-bd98c0ba2589
71115
strict-transport-security:
72116
- max-age=31536000
73117
x-ms-ags-diagnostic:
74-
- '{"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF000002BF"}}'
118+
- '{"ServerInfo":{"DataCenter":"Central India","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"PN3PEPF000003AE"}}'
75119
status:
76120
code: 204
77121
message: No Content

src/nexusidentity/azext_nexusidentity/tests/latest/test_nexusidentity_scenario.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Nexus Identity Ssh-Key Geneation Scenario Test
88
'''
99

10-
from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer
10+
from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, live_only
1111

1212
def setup_scenario1(test):
1313
''' Env setup_scenario1 '''
@@ -35,8 +35,9 @@ class NexusidentityScenarioTest(ScenarioTest):
3535

3636
def __init__(self, *args, **kwargs):
3737
super().__init__(*args, **kwargs)
38-
38+
39+
@live_only()
3940
def test_nexusidentity_scenario1(self):
4041

4142
# Testcase: scenario1
42-
call_scenario1(self)
43+
call_scenario1(self)

src/nexusidentity/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# TODO: Confirm this is the right version number you want and it matches your
1818
# HISTORY.rst entry.
19-
VERSION = '1.0.0b3'
19+
VERSION = '1.0.0b4'
2020

2121
# The full list of classifiers is available at
2222
# https://pypi.python.org/pypi?%3Aaction=list_classifiers

0 commit comments

Comments
 (0)