@@ -7,6 +7,7 @@ class VaultBaseAction(Action):
77 Base Action includes st2 profile and vault client functions
88 for child classes.
99 """
10+
1011 def __init__ (self , config ):
1112 super ().__init__ (config )
1213 self .config = config
@@ -19,7 +20,9 @@ def run(self, profile_name=None):
1920 if profile_name is None :
2021 profile_name = self .config .get ("default_profile" )
2122 if profile_name is None :
22- raise ValueError ("No default profile found, check the pack configuration." )
23+ raise ValueError (
24+ "No default profile found, check the pack configuration."
25+ )
2326
2427 for profile in self .config .get ("profiles" , []):
2528 if profile_name == profile ["name" ]:
@@ -78,7 +81,18 @@ def _auth_approle(self, profile):
7881 """
7982 Authenticate using a vault app role to acquire the vault token.
8083 """
81- self .vault .auth .approle .login (
82- role_id = profile ["role_id" ],
83- secret_id = profile ["secret_id" ],
84- )
84+ # Check if mount_point is provided in the profile
85+ mount_point = profile .get ("mount_point" )
86+
87+ # Prepare login arguments
88+ login_kwargs = {
89+ "role_id" : profile ["role_id" ],
90+ "secret_id" : profile ["secret_id" ],
91+ }
92+
93+ # Add mount_point to kwargs if it exists in the profile
94+ if mount_point :
95+ login_kwargs ["mount_point" ] = mount_point
96+
97+ # Replace the direct login call with kwargs-based call
98+ self .vault .auth .approle .login (** login_kwargs )
0 commit comments