* Added --current flag to set-context command to use current-context
when context not provided
* Added validation to throw error when both context and --current flag
* Updated golden files to match the recent change
given
* Added validation to check if current context is set when --current
flag is provided
Old Format: airshipctl config set-context default --manifest default --namespace default
New Format: airshipctl config set-context --current --manifest default --namespace default
Change-Id: I9ffe3a34f33ffd7ff03ca42de7609f91f5386b37
Now that --current-context is removed for set-context, removing all
references of --current-context for set-context in test cases.
Change-Id: Ib77a8dba4a245c61d1d6c057561b0f6983d80cd3
This commit adds the utility testing function TempDir, which provides a
tester with a temporary directory as well as a means of cleaning up that
directory. The new function is implemented everywhere that makes sense
throughout the code base.
This also cleans up the directories left behind by go-git's testing
fixtures.
Some light refactoring was also performed in this change.
Change-Id: I754484934660487140f57671bacb5463cf669e3e
Executing "airshipctl config set-context [NAME]" misleadingly prints a
message saying the context has been modified, but doesn't change to that
context or modify any context values. This change modifies the behavior
of context command to switch to a provided context when no flags are
specified. It also removes the current-context flag, which becomes
redundant with this change.
Change-Id: I2622fbf59539513feb1236f13b9090978aeb81ef
Signed-off-by: Drew Walters <andrew.walters@att.com>
This change introduces logic for the config init subcommand, which
generates an airshipctl configuration file with default values. The
default values are extracted from constants and change when the source
code is updated.
Closes #6
Change-Id: I452e26bc5a924f0cdcd3153a9b124d23e2e5b1f0
Signed-off-by: Drew Walters <andrew.walters@att.com>
Render command filters documents and prints them to user-defined
output in a form of multi-document YAML.
Sub-command receives following document filter flags:
* label
* annotation
* apiVersion (a.k.a group-version)
* kind
* filter
Related: #16
Change-Id: I7efb0a478e1070efd1791ab10d7c3946c8c28630
Adds `airshipctl document pull` command that will check the current
manifest specified by the config and download it to the config specified
target path.
Change-Id: I493564c056225ff1e19f5d1aecb8c187683529ec
Commands using cobra's ExactArgs feature previously did not have any
validation that the ExactArgs was being enforced. This patchset adds
tests to ensure that in the cases ExactArgs=n, that only n args are
accepted, and other values such as x or y throw an appropriate error.
Change-Id: I27b5774e79db51e0e9bc81d8c207be80811ba459
In the completion command validation was being done at runtime to
determine if too many or too few args were being passed in. This
approach required extra unit tests to validate the behavior.
This patch seeks to streamline the code by specifying the number of
args expected when initializing the cobra command, and allowing cobra
to throw an error before doing any work in go if the number of args is
incorrect.
As a result the unit tests for too many and too few args are no longer
needed for this package and have been removed.
Change-Id: If0cf043713ef08333f17b010210352205d74c4ee
For cluster names that contain underscore ('_') symbol config module
removed some part of the name due to hardcoded indexes after name split
Change-Id: Ibd1e9b3ef2fce7e43cbdf41f4b1852933a253868
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
to manage authentication information for clusters.
Includes username/password, certificate
and token options.
Change-Id: If95e5bbf5c3ddc4732465e81de407d5ad416e8f2
This fixes an issue where `airshipctl config get-context` would provide
no output when there were no contexts in the configuration.
Change-Id: I8eaafff8ecee7878f80d22867b0420feba1bf376
Prior to this change, flags associated with the Config object were being
read too early (that is, before cobra had parsed them). They are now
read just in time for command execution.
Change-Id: I0affca9429867eb25db40f8323403e0f6976b47b
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
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
This changes the unit tests in ./cmd/config/get_cluster.go by swapping
out the `run` function for the pre-built CmdTest. This matches the
conventions of the existing test bed.
Change-Id: I4cecd211fe7ab74a1151635f29bda578887f400a
This commit changes several unit tests to set a "workspace" in a temp
directory. This completely isolates them from other tests as well as the
developer's environment.
Change-Id: Ifa1048c427dc3d69e15dae04318c7d8463b8f8e1
This commit removes any assertion from Go's "testing" package,
preferring instead to use an assertion from the testify package. All
tests now have uniformity.
This also decrease the number of iterations in the password generation
test, decreasing test runtime tenfold
Change-Id: I8799110e93dfa19bebe9050528e865b4c991c3df
* Documents the expectations for unit-tests
* Updates the tests to the version command so as to provide a clear
example of how to test commands.
Change-Id: I3fbb509a2e4298b4ae68200764a6034459b61602
* This also makes some minor newline changes to output.
* This also changes the behavior of nil objects to compare equal to
other nil objects. This follows the pattern of builtin Go types.
Change-Id: I10d99bbd5251db594a302ca65cd21917804d6a20
This implementation creates named references between an airship
config file , and a user specified or system default kubeconfig file
airshipconfig location can be specified via an envirnment variable
or via
--airshipconf string Path to file for airshipctl configuration.
(default ".airship/config")
kubeconfig has to be explicitly stated using the argument below
--kubeconfig string Path to kubeconfig associated with airshipctl
configuration. (default ".airship/kubeconfig")
if the argument is not specified a default empty kubeconfig will be
used using the default ".airship/kubeconfig"
All subcommands exposed via airshipctl config will update airship
config and airship related kubeconfig
when appropriate.
This patchset adds :
- Config Struct (type)
- config cmd and pkg
- get_cluster : List a specific name cluster or
List all clusters if no name is provided.
- set-cluster : Create or Modify an existing cluster.
Review comment fixes as of Pathset 19
- Moved core functionality from cmd to pkg
- Encapsulate cmd needs in pck in nw files cmds, cmds_types and cmds_test .
Expectation is that other functions will need func an structs there.
- added test for GetCluster
- Added GetCluster method to config object to be used by get_cluster command
- Change ClusterNames func as per review suggestion
- Change TestEmpty Cluster to avoid pointing to non test kubecnfig by default
- Change constant AirshipConfigFilePath to AirshipConfigDir
- Renamed config_utils to utils
- Added config cmd output tests
- Changes to settings_test.go to clean after itself.
- Created new pkg/config/testdata/GoldenString for struct data comparison values to avoid confusion
- Fix small get_cluster no name issue when empty config
- Fix issue when reconciling a cluster info that only exists in airship config and not in kubeconfig
Increased coverage to: SUCCESS: Test coverage is at 84.2%,
Started to move all testdata to a single place under pkg/config for now.
Change-Id: I7aae1f15afaebc99407f7fabccecf86ab0923bc3
This commit implements redfish remote direct subcommand
under bootstrap.
Change-Id: Idf97445f6fa59a77145eae1edaa15b1d22723f19
Signed-off-by: Kanwar Saad Bin Liaqat <kanwar.sbl@gmail.com>
This updates references to 'kubernetes' to be consistent with
the proper naming reference used elsewhere ('Kubernetes').
Change-Id: Ia44f5cbc75c2fba79ac6531282e0612e62cbb9f9
Signed-off-by: Steve Wilkerson <sw5822@att.com>