16 Commits

Author SHA1 Message Date
Sirisha Gopigiri
3274b41151 Config- updating cmd files for documentation
The description and examples are updated for the airshipctl
commands, which will be inturn used for generating documentation.
Please ignore the .md file changes in this PS. They are added for zuul
gates to pass. Here is the PS with generated documention
files https://review.opendev.org/c/airship/airshipctl/+/789250

Relates-To: #280
Change-Id: If3ec175e2f582919296576a4bff6ae64871a7333
2021-05-25 12:14:59 +05:30
chumkid
02d2fc7e4a Show the context name and current context using get-context command
The command "airshipctl config get-context" will display the name of the contexts as well as the current context name.

Relates-To: #475
Change-Id: I8234d74f6b98869e27e4974a54b68230d8be8565
2021-05-19 13:42:22 +05:30
Sirisha Gopigiri
f70e93762f Fix airshipctl config get-context maximum args
Limit the number of arguments that can be passed to
get-context command to 1 for now

Closes: #526
Change-Id: Ib140fc836e01c284c05719dfb7e3f29d0b191538
2021-04-16 19:03:54 +05:30
Ruslan Aliev
0c870e5244 Remove clustertype-related functions
We don't use clustertype anymore, so all the related functions must
be deleted or adjusted as well as appropriate config fields.

Change-Id: I3931fdc71d4318e916f8bbc2d94e062c9df5f641
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #349
2020-10-16 11:31:58 -05:00
bijayasharma
e99adf50ad Removed K8s Authors
To make it consistent, this commit will remove K8s authors
from copyright section.

Change-Id: I4e670cc76ea1feb6456965707a8deff258e5f215
2020-09-23 11:36:43 -04:00
Ruslan Aliev
63b3501a53 Refactor config* commands
All the config commands was refactored for usage with new config
factory. Config object now is being initialized in pkg module on demand,
which provides more flexibility and cleaner code.

Change-Id: Ibad0985e30c16efa96109a49edf2840c60305df8
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ian Howell
f1591bc347 Add pluralized aliases to config get commands
This changes the `get-credentials` command to `get-credential` to be
uniform with the other config commads. It then adds pluralized aliases
to `get-credential`, `get-cluster`, and `get-context`

Change-Id: Icb5a308f591589f5b68a8ad1c172c3b99ef3a4f1
2020-05-06 14:35:29 -05:00
Ian Howell
9ffc305392 Define a standard for creating commands
This commit cleans up the command constructors in an attempt to make the
codebase more uniform and approachable. This includes several refactors:

* Removed the FlagConstants - this makes the help messages and examples
  significantly more readable without needed to compile and run
  airshipctl
* Long help messages and examples are now constant
* Short, Long, and Examples all begin with a capitol letter
* Flag descriptions begin with a lowercase letter. This matches the flag
  description for the builtin "help" flag, making formatting uniform for
  all flags
* Removed redundant unit tests on non-leaf commands

This change also updates the documentation for the affected commands.

Change-Id: I8b9dcbfd9846b3deaab06dec17f80643dae78de9
2020-04-24 10:50:59 -05:00
Yasin, Siraj (SY495P)
01d66c834d Organize CLI helper functions
* moving cli helper functions to the respective packages with _helper.
* removed cmds.go within pkg/ dir and added config_helper.go

* In the first commit(https://review.opendev.org/#/c/707216/) commit CLI helper
  functions were moved from the cmd/config package to the pkg/config package
* Now we are trying to move the CLI helper functions within their respective packages instead of a command cmds.go.
* Creating and implementing this convention will help us better distinguish library code and CLI helper code
* Added MaxNArgs as 1 for get-credentials and updated test cases

Relates-To: #43
Change-Id: Ibb8139102bd98c6c7596bd97377cf83381cbeb00
2020-04-17 09:28:18 -05:00
Ian Howell
5efc26d9f0 Remove getters/setters of AirshipCTLSettings
This change removes the getters and setters for the following attributes
of pkg/environment.AirshipCTLSettings:

* airshipConfigPath
* kubeConfigPath
* config

The above attributes have been exported to account for the removal of
these methods.

Change-Id: I4e7d38bf6771f7521179a2fe2990475b936b5d95
2020-04-08 09:00:32 -05:00
Ian Howell
dc0979b65b [#42] Refactor flag operations to be uniform
This also increases unit test coverage

Change-Id: I324954a1216f2204ff3977c05eb9bd087cd87795
2020-02-20 11:25:41 -06:00
Ian H. Pittwood
69b37c15b8 [#27] Move execution logic from cmd to pkg
Moves all execution logic from cmd/config to pkg/config.

Adds tests for moved execution logic.

Change-Id: I6381c9fe9eeba938e855bf7d7ea52cd22a5c08b6
2020-02-11 15:33:47 -06:00
Ian H. Pittwood
c7c1011a5c Fix various code style issues
Fixes possible name collisions between variable names and package names

Remove redundant import naming

Use nil slices for slice declarations instead of empty slices

Use make for slices of fixed lengths

Remove redundant parentheses

Replace deprecated `SetOutput` method with `SetOut`

Fix swapped actual/expected arguments on assertEqualGolden

Change-Id: Ia39ef44372c3e44948e5440575125bdb470898df
2020-02-07 09:28:18 -06:00
Ian Howell
73f9eb383b Fix an output bug in get-context
This fixes an issue where `airshipctl config get-context` would provide
no output when there were no contexts in the configuration.

Change-Id: I8eaafff8ecee7878f80d22867b0420feba1bf376
2020-01-27 12:08:34 -06:00
Ian Howell
49027f4151 Tighten the restrictions of the linter
This change causes the linter to be a bit more complainy. The hope is
that this will cut down on some of the more pedantic issues being caught
in code reviews, and thus reduce the overall time a change spends in the
review process.

This change includes various changes to the codebase to bring it up to
the new standards.

Change-Id: I570d304bca5554404354f972d8a2743279a0171b
2020-01-10 14:54:34 -06:00
Rodolfo Pacheco
a480527808 Introduces set_context and get_context operations
Each of these include an option for --current-context that set or retrieves
the curret context

This patchset mainly creates the cmd/config and pkg/config require additions

Also includes a fync getCurrentContext(<CLUSTERTYPE>)  in the config pkg
that other modules should rely on.

Introduces new  ErrMissingConfig and  ErrConfigFailed types been used by
set-context, will decimate through get/ and set/get cluster after this is
reviewed.

Change-Id: I501483a9db99f33f860eaf329a65bb0209b2aaff
2020-01-08 11:46:16 -05:00