zeroflag opened a new pull request, #583:
URL: https://github.com/apache/knox/pull/583

   ## What changes were proposed in this pull request?
   
   KnoxCLI only allow creating one alias at a time which can be really slow if 
we want to create lots of aliases.
   
   This patch introduces batch alias creation using the following syntax:
   
   ```bash
   bin/knoxcli.sh create-alias name1 --value value1 create-alias name2 --value 
value2 create-alias name3 --value value3
   ```
   
   ## How was this patch tested?
   
   ```bash
   $ bin/knoxcli.sh create-alias abc --cluster c0 --value vvv
   abc has been successfully created.
   $ java ShowKey development/test/data/security/keystores/c0-credentials.jceks 
gateway abc
   vvv
   
   $ bin/knoxcli.sh create-alias def --cluster c0 
   Enter password: 123
   Enter password again: 123 
   def has been successfully created.
   $ java ShowKey development/test/data/security/keystores/c0-credentials.jceks 
gateway def
   123
   
   $ bin/knoxcli.sh create-alias efg --cluster c0 --generate
   efg has been successfully generated.
   
   $ java ShowKey development/test/data/security/keystores/c0-credentials.jceks 
gateway efg
   S7FBGc9ddr3KNBkf
   
   $ bin/knoxcli.sh create-alias ghj --value 456
   ghj has been successfully created.
   
   $ java ShowKey 
development/test/data/security/keystores/__gateway-credentials.jceks gateway ghj
   456
   
   $ bin/knoxcli.sh create-alias a1 --value v1 create-alias a2 --value v2 
create-alias a3 --value v3
   3 aliases have been successfully created.
   $ java ShowKey 
development/test/data/security/keystores/__gateway-credentials.jceks gateway a1
   v1
   $ java ShowKey 
development/test/data/security/keystores/__gateway-credentials.jceks gateway a2
   v2
   $ java ShowKey 
development/test/data/security/keystores/__gateway-credentials.jceks gateway a3
   v3
   
   $ bin/knoxcli.sh create-alias a1 --value v1 create-alias a2 --value v2 
create-alias a3 --value v3 --cluster cl1
   3 aliases have been successfully created.
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a1
   v1
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a2
   v2
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a3
   v3
   
   
   $ bin/knoxcli.sh create-alias a1 create-alias a2 create-alias a3 --cluster 
cl1
   Enter password: 1
   Enter password again: 1
   Enter password: 2
   Enter password again: 2 
   Enter password: 3
   Enter password again: 3
   3 aliases have been successfully created.
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a1
   1
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a2
   2
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a3
   3
   
   
   $ bin/knoxcli.sh create-alias a1 create-alias a2 create-alias a3 --cluster 
cl1 --generate
   3 aliases have been successfully generated.
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a1
   Z7jKDm8v8KCMCWm4
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a2
   nCrgpJNHwMz6Kdyn
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a3
   bn4MdsfSJXxYUVqW
   
   $ bin/knoxcli.sh create-alias a1 create-alias a2 --value v2 create-alias a3 
--value v3 --cluster cl1 --generate
   a1 has been successfully generated.
   2 aliases have been successfully created.
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a1
   N5KyFHtqzxFZwZ6r
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a2
   v2
   $ java ShowKey 
development/test/data/security/keystores/cl1-credentials.jceks gateway a3
   v3
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to