typesafehub / conductr-cli

CLI for Lightbend ConductR
Other
16 stars 21 forks source link

Depend on dcos 0.5.5 cli and fix package.json bug #548

Closed longshorej closed 6 years ago

longshorej commented 6 years ago

Fixes #512

This PR ensures that conduct setup-dcos creates a package.json file.

This PR also removes the imported source for the dcos CLI and depends on 0.5.5 as https://github.com/dcos/dcos-cli/issues/818 is now fixed. This is required for DC/OS 1.10 support. See below.

longshorej commented 6 years ago

Manual Tests

Prior to this PR, dcos conduct info would fail due to auth failure as the DC/OS API has changed to support multiple clusters. See below usage showing the old failures and successes after this PR.

Auth Failure

# Despite `dcos auth login` succeeding, `dcos conduct info` would always fail on 1.10.
$ dcos conduct agents
Encountered unexpected error.
Reason: DCOSAuthenticationException Authentication failed. Please run `dcos auth login`
Further information of the error can be found in the error log file: /home/longshorej/.conductr/errors.log
-> 1

package.json failure, followed by procedure and proof of fix

$ dcos package list
Error opening file [/home/longshorej/.dcos/subcommands/conductr/package.json]: No such file or directory
-> 1

$ conduct setup-dcos
The DC/OS CLI is now configured.
Prefix 'conduct' with 'dcos' when you want to contact ConductR on DC/OS e.g. 'dcos conduct info'
-> 0

$ dcos package list
NAME      VERSION  APP  COMMAND   DESCRIPTION                                                  
conductr  N/A      ---  conductr  To uninstall, use `dcos marathon app remove <service-name>`  
-> 0

Now works with new DC/OS CLI

$ dcos conduct info
UNLICENSED - please use "conduct load-license" to use more agents. Additional agents are freely available for registered users.
Licensed To: unknown
Max ConductR agents: 1
ConductR Version(s): 2.1.*
Grants: conductr, cinnamon, akka-sbr

ID  NAME  TAG  #REP  #STR  #RUN  ROLES
-> 0

Licensing works

$ dcos conduct load-license --offline
Skipping downloading license from Lightbend.com
Loading license into ConductR at m1.dcos

Licensed To: cc64df31-ec6b-4e08-bb6b-3216721a56b@lightbend
Max ConductR agents: 3
ConductR Version(s): 0.1.0, 2.1.*
Grants: akka-sbr, cinnamon, conductr

License successfully loaded
-> 0

Loading bundle works

$ dcos conduct load visualizer
Retrieving bundle..
Resolving bundle using [bintray_resolver, docker_resolver]
Loading bundle from cache typesafe/bundle/visualizer
Bintray credentials loaded from /home/longshorej/.lightbend/commercial.credentials
Retrieving from cache /home/longshorej/.conductr/cache/bundle/visualizer-2.1.0-cabaae7cf37b1cf99b3861515cd5e77a16fa9638e225fa234929cc1d46dde937.zip
Loading bundle to ConductR..
[##################################################] 100%
Bundle cabaae7cf37b1cf99b3861515cd5e77a is installed
Bundle loaded.
Start bundle with:        dcos conduct run cabaae7
Unload bundle with:       dcos conduct unload cabaae7
Print ConductR info with: dcos conduct info
Print bundle info with:   dcos conduct info cabaae7
-> 0

$ dcos conduct run visualizer
Bundle run request sent.
Bundle cabaae7cf37b1cf99b3861515cd5e77a waiting to reach expected scale 1
Bundle cabaae7cf37b1cf99b3861515cd5e77a has scale 0, expected 1.
Bundle cabaae7cf37b1cf99b3861515cd5e77a expected scale 1 is met
Stop bundle with:         dcos conduct stop cabaae7
Print ConductR info with: dcos conduct info
Print bundle info with:   dcos conduct info cabaae7
-> 0

dcos conduct info visualizer
BUNDLE ATTRIBUTES
-----------------
Bundle Id              cabaae7
Bundle Name            visualizer
Compatibility Version  2
System                 visualizer
System Version         2
Tags                   2.1.0
Nr of CPUs             0.1
Memory                 402653184
Disk Space             200000000
Roles                  web
Bundle Digest          cabaae7cf37b1cf99b3861515cd5e77a16fa9638e225fa234929cc1d46dde937
Error                  No

BUNDLE SCALE
------------
Nr of Reschedules  0
Scale              1

BUNDLE INSTALLATIONS
--------------------
Host    192.168.65.111
Bundle  /tmp/conductr/192.168.65.111/bundles/cabaae7cf37b1cf99b3861515cd5e77a16fa9638e225fa234929cc1d46dde937.zip

BUNDLE EXECUTIONS
-----------------
ENDPOINT    HOST            PID  STARTED  UPTIME  BIND_PORT  HOST_PORT
visualizer  192.168.65.111  131      Yes     14s      14000      14000

HTTP ACLS
---------
METHOD  PATH  REWRITE  STATUS
*       ^/             Running

SERVICE NAMES
-------------
SERVICE NAME  STATUS
visualizer    Running

-> 0