366 Commits

Author SHA1 Message Date
Tomas Kral
604b98b17d Use context in logout command 2018-11-13 17:34:15 +01:00
Tomas Kral
1ee505249e Merge pull request #699 from syamgk/logout
Add command odo logout
2018-11-13 17:05:04 +01:00
Chris Laprun
2e91e59bff Factor out creation of contextual information (project, application, component) to make it easier to manage and facilitate refactoring of commands (#949)
* Use constants for flag names.

* Introduce Context struct and use it to replace util.GetComponent

* Remove redundant break statements.

* Do not exit when attempting to access a possibly not defined flag.

* Fix improper logic.

* Add ComponentAllowingEmpty to make it more useful and use it.

* Start removing usage of util.GetAppName

* Remove unneeded check for error (no error can occur there).

* Deprecate GetAppName in favor of Context.Application.
Will need to use Context in completion infrastructure as well but this
will be part of a later PR.

* Remove unneeded (and invalid) GetOrCreateAppName function.

* Deprecate GetAndSetNamespace and remove it where possible.
Can't currently touch the completion handlers.

* Make completion handlers use Context and allow
them to access the current command.
This allows removal of GetAppName and GetAndSetNamespace.

* Replace GetOcClient function by genericclioptions.Client and ClientWithConnectionCheck

* Remove now unneeded global variables and GetOcClient function.

* Fix improper check if component flag has been set.

* Polish and add comments.

* Update FileCompletionHandler.

* Fix formatting.

* Fix AppCompletionHandler.

* Rename existsOrExit to be more explicit.

* Change error code.

* Replace todo by TODO.
2018-11-13 16:51:11 +01:00
syamgk
8a9aa1dbbc changed function according to refactoring 2018-11-13 17:51:10 +05:30
syamgk
9afe492c95 change help msg to be more specific and rename KubeConfig 2018-11-13 17:51:10 +05:30
syamgk
4a6e891a27 fix help msg 2018-11-13 17:51:10 +05:30
syamgk
1601209e8a move logout under utility + fix e2e test 2018-11-13 17:51:10 +05:30
syamgk
a2302a5cf2 fix error msg, add err check and unexport Conf 2018-11-13 17:51:10 +05:30
syamgk
ccf25a2947 rename logout cmd description 2018-11-13 17:48:40 +05:30
syamgk
48a65e41c0 Add command odo logout
- add func RunLogout in occlient
2018-11-13 17:48:40 +05:30
Tomas Kral
077441681b Merge pull request #826 from surajnarwade/login-trial
odo login
2018-11-13 12:53:15 +01:00
Georgios Andrianakis
0ee8c4ed77 Improve odo link support (#847)
* Improve odo link support

- Provide wait flag for secret to be present
- Improve error messages
- Provide detailed statuses for deployed services

Fixes: #846

* Polish
2018-11-13 15:30:04 +05:30
Suraj Narwade
71e9bffc8d odo login 2018-11-13 15:19:46 +05:30
Suraj Narwade
fdb2bad291 Added command completion for odo app commands (#934)
* `odo app describe`
* `odo app delete`
* `odo app set`
2018-11-12 13:18:53 +01:00
Mrinal Das
f79341f82e Added completion support for files and directories. (#962)
This completion handler is added to the create command for the local and binary flags.
Signed-off-by: mik-dass <mrinald7@gmail.com>
2018-11-12 10:42:10 +01:00
Suraj Narwade
3d79962665 Added --client flag to odo version (#935)
This PR adds `--client` flag to `odo version` command so that,
to check only client version, we dont need to talk to server.
(Similar to `kubectl`)

Usage:

```
odo version --client
```
2018-11-12 11:27:53 +02:00
Mrinal Das
16ec149a2f Adds a new line in odo app describe when there is no active application in project (#956) 2018-11-12 10:37:27 +02:00
Charlie Drage
b19f9b5d81 Correct link documentation (#958)
Corrects the link documentation with the correct examples (library /
component source FIRST and then the name..)
2018-11-09 10:47:17 -05:00
Georgios Andrianakis
294609258b Make link handling common across both components and services (#856)
This is done by making `link` always "inject" a secret into the
DeploymentConfig of the source component.
In the case of services, the secret is created indirectly via the
ServiceBinding.
In the case of components, the secret is created when when we create
the component. In such cases on secret is created per exposed port.

Fixes: #652
2018-11-07 12:56:55 -05:00
Georgios Andrianakis
f88af92935 Change version command to tolerate missing possible /version/openshift (#920)
This is done because a cluster created with "oc cluster up" can in some
cases (as is the case for OKD 3.11) the endpoint is missing completely
and we don't want the tool to fail in such cases (following the example
set by oc)

Fixes: #872
2018-11-07 14:36:28 +02:00
anmolbabu
59d3a4cd4c Incorporate @kadel suggestion
This commit makes pushlocal function a parameter to ease unit testing

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-11-01 20:11:59 +05:30
anmolbabu
81385dde93 Add unit tests and e2e for the watch command
1. WatchAndPush: The test for this function:
       i. Creates a temporary component source directory structure
      ii. Mocks implementation of PushLocal to only use compare the diff set against the expected ones
     iii. Creates, deletes and modifies some files and folders
      iv. Ignores some files and folders specified using regexp
       v. Also, stops the watch gracefully at the end of the tests using the newly added extChan channel.
2. e2e test for watch does the following:
	i. Uses the wildfly component local source for component creation
       ii. Spawns a go-routine to simulate file modifications to test watch
      iii. Starts execution of non-terminating watch command witha timeout and when test condition passes
	   before timeout, the command gracefully exits

fixes #770
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-11-01 20:11:59 +05:30
Tomas Kral
e17ea7741c Merge pull request #906 from cdrage/open-link
Open created url with --open
2018-11-01 15:05:50 +01:00
Charlie Drage
942818032a Open created url with --open
This function adds the --open parameter to `odo url create`.

This will open the created link on the user's default browser.

To test:

```sh
odo create nodejs
odo url create --open
```

Closes https://github.com/redhat-developer/odo/issues/905
2018-11-01 08:56:45 -04:00
Chris Laprun
f0e203fa83 Fix #913: fix completion handler key generation.
It should now work even the command hierarchy is not complete and the
code is also simpler. Win! :)
2018-10-31 22:53:32 +01:00
Chris Laprun
316da3e084 Fix #903: rewrite completion handler key generation to avoid collisions.
The previous implementation only used the command's name as key which
wasn't enough. This implementation requires the command hierarchy to be
resolved before the registration process as the key is generated by
walking back to the root command. The implementation will exit with an
error message if registration happens before the hierarchy is set.
2018-10-31 14:44:03 +01:00
Chris Laprun
f654db26fa Rename util2 to odoutil. 2018-10-31 11:05:46 +01:00
Chris Laprun
8ed9a67968 Move getAndSetNamespace, getAppName and getComponent to pkg/odo/util. 2018-10-31 11:05:46 +01:00
Chris Laprun
c87ef76fa0 Move completion handlers to completion package. 2018-10-31 11:05:46 +01:00
Chris Laprun
268cb77dc3 Remove old bash completion code. Update cli-reference. 2018-10-31 11:05:46 +01:00
Chris Laprun
e6c9c4c00c Extract completion handling into specific go package. 2018-10-31 11:05:46 +01:00
Chris Laprun
21144058cc Encapsulate internal implementation of handlers handling for extraction. 2018-10-31 11:05:46 +01:00
Chris Laprun
aa29bbf35e Move getOcClient and checkError to pkg/odo/util. 2018-10-31 11:05:46 +01:00
Y.Horie
ed29d715dc check application existence before confirmation #888 (#897)
* check application existtence before confirmation #888

* fix error message not exist apps #888
2018-10-31 11:44:08 +05:30
Georgios Andrianakis
627b823021 Enhance the odo service describe
A new struct ServicePlanParameter is introduced that contains
information about all parameters of a plan
The UI is also updated to show this information
(albeit in a non optimized way)

Fixes: #880
2018-10-30 18:19:11 +02:00
Syam.G.Krishnan
73173d5ac5 add config parameter to modify server connection check timeout (#757)
* fix #617 : add config parameter to change default timeout

add config parameter to modify server connection check timeout

* incorporated comments

* modify comment

* cleaned unwanted comments

* incorporated comments
2018-10-30 08:58:32 -04:00
Suraj Narwade
cb231889b6 Fixing service.go (#895)
This PR fixes small change which was missed in  https://github.com/redhat-developer/odo/pull/683 and  breaking master
2018-10-30 11:03:26 +01:00
Suraj Narwade
c7dedf3424 set project while setting application 2018-10-30 14:27:59 +05:30
Suraj Narwade
163b9b3898 handled error with checkerror() 2018-10-30 14:27:59 +05:30
Suraj Narwade
1ad5816a4a updated the flag name 2018-10-30 14:27:59 +05:30
Suraj Narwade
edde423d8b added project name in statements in application.go 2018-10-30 14:27:59 +05:30
Suraj Narwade
5110a72a16 updated small fixes 2018-10-30 14:27:59 +05:30
Suraj Narwade
bc233f3087 updated golangci & codeclimate bot's comment 2018-10-30 14:27:59 +05:30
Suraj Narwade
9f3929bb04 removed projectName argument from the functions 2018-10-30 14:27:59 +05:30
Suraj Narwade
c0616a7995 Refactoring code and added flags project, application & component
This PR does:

* Adds flags `project`, `application` and `component` flag to respective commands

* added `getProjectName` and `getAppName` reusable functions which looks for `project` or `application` flag first, if not provided then it gives current value by default.

* Provide comments to some of the exported functions

* Refactors the way we provide `namespace` value for methods in `occlient.go`.
(No method will accept namespace as a argument, whenever needed we will use `client.Namespace` value)

* Updated unit tests as per new refactoring
2018-10-30 14:27:59 +05:30
Chris Laprun
2fb026f084 Completion in go (#859)
* Initial implementation setting up of smart completion.

* Initial implementation for service delete.

* Initial implementation for service create.
This doesn't work properly because we really need to be able to
distinguish between positional arguments.

* Clean-up.

* Add doc.

* Add doc.

* Refactor completion handler code to make it easier to test. Add tests.

* Update vendor.

* Filtering doesn't occur at the completion handler level at this point.

* Add test for delete completion.

* Update glide and vendor.

* Fix format.

* Fix format.

* Add MPL-2.0 to licenses.

* Revert to 1.1.2 version of complete library due to bug with 1.2.0.
See https://github.com/posener/complete/issues/74

* Fix odo -h.
2018-10-29 13:46:45 +05:30
Suraj Narwade
ff6af620fc Fixed project deletion 2018-10-29 11:57:34 +05:30
Charlie Drage
abbd779ebc Updates spacing / newlines on --help messages (#841)
Some of the help messages have newlines as well as spacing issues. This
PR corrects it.
2018-10-26 12:22:40 -04:00
Mrinal Das
2e6e6beed6 Added the odo catalog describe service command (#756)
* Added the odo catalog describe service command e.g `odo catalog describe service <service-name>`

Functions GetClusterServiceClass() and GetClusterPlansFromServiceName() are added to occlient to get the service class and the plans associated with the class.

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Fixed the service command format and examples

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Fixed the problem of checking in application for service existence

* Add support for optional params

* Renamed some plan variables and the short/long description for generic describe command

* Fixed sentance and indentation in the example
2018-10-26 08:47:12 -04:00
Tomas Kral
f6843f4679 Merge pull request #836 from cdrage/update-port
Adds -p option for --port, updates help message
2018-10-24 13:26:54 +02:00