Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional DEBUG info to che-launcher #1957

Merged
merged 4 commits into from
Jul 27, 2016
Merged

Add additional DEBUG info to che-launcher #1957

merged 4 commits into from
Jul 27, 2016

Conversation

TylerJewell
Copy link

What does this PR do?

This pull request adds additional information to the 'info' command on the 'che-launcher'.

What issues does this PR fix or reference?

#1951

New Behavior

run docker run -v /var/run/docker.sock:/var/run/docker.sock codenvy/che-launcher info

DEBUG: ---------------------------------------
DEBUG: ---------  CHE DEBUG INFO  ------------
DEBUG: ---------------------------------------
DEBUG:
DEBUG: ---------  PLATFORM INFO  -------------
DEBUG: DOCKER_INSTALL_TYPE       = native
DEBUG: DOCKER_HOST_OS            = CentOS Linux 7 (Core)
DEBUG: DOCKER_HOST_IP            = 10.0.2.15
DEBUG: DOCKER_DAEMON_VERSION     = 1.11.2
DEBUG:
DEBUG:
DEBUG: --------- CHE INSTANCE INFO  ----------
DEBUG: CHE CONTAINER EXISTS      = YES
DEBUG: CHE CONTAINER STATUS      = running
DEBUG: CHE SERVER IS STATUS      = running
DEBUG: CHE IMAGE                 = codenvy/che-server:nightly
DEBUG: CHE SERVER CONTAINER ID   = 8c1c7390374d
DEBUG: CHE CONF FOLDER           = not set
DEBUG: CHE DATA FOLDER           = /home/user/che/workspaces
DEBUG: CHE DASHBOARD URL         = http://localhost:{CHE_PORT}
DEBUG: CHE API URL               = http://localhost:{CHE_PORT}/api
DEBUG: CHE LOGS                  = run `docker logs -f che-server`
DEBUG:
DEBUG:
DEBUG: ----  CURRENT COMMAND LINE OPTIONS  ---
DEBUG: CHE_PORT                  = 8080
DEBUG: CHE_VERSION               = che-launcher
DEBUG: CHE_RESTART_POLICY        = no
DEBUG: CHE_USER                  = root
DEBUG: CHE_HOST_IP               = 10.0.2.15
DEBUG: CHE_LOG_LEVEL             = info
DEBUG: CHE_HOSTNAME              = localhost
DEBUG: CHE_DATA_FOLDER           = /home/user/che
DEBUG: CHE_CONF_FOLDER           = not set
DEBUG: CHE_LOCAL_BINARY          = not set
DEBUG: CHE_SERVER_CONTAINER_NAME = che-server
DEBUG: CHE_SERVER_IMAGE_NAME     = codenvy/che-server
DEBUG:
DEBUG: ---------------------------------------
DEBUG: ---------------------------------------
DEBUG: ---------------------------------------

Tests written?

No

Docs requirements?

Docs not needed.

Please review Che's Contributing Guide for best practices.

@codenvy-ci
Copy link

Build # 1315 - FAILED

Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/1315/ to view the results.

@garagatyi
Copy link

garagatyi commented Jul 27, 2016

LGTM
BTW inlined if then else construct can also have next syntax:
$(che_container_is_running && echo "running" || echo "stopped")

@@ -117,6 +117,14 @@ get_docker_host_ip() {
awk '{ print $2}'
}

get_docker_host_os() {
echo $(docker info | grep "Operating System:" | sed "s/^Operating System: //")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 'echo $(cmd)', just use 'cmd'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@l0rd
Copy link
Contributor

l0rd commented Jul 27, 2016

Great job @TylerJewell ! I've written some tests to verify your new functions and everything worked well (except get_docker_daemon_version). Can you add these to launcher_tests.bats please?

@test "get container conf folder that is set" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-container-conf-folder"
  CONF_FOLDER=$(pwd)/che-test-conf
  mkdir ${CONF_FOLDER}
  docker run --name ${CHE_SERVER_CONTAINER_NAME} -v ${CONF_FOLDER}:/conf alpine:3.4 true

  # When
  result="$(get_che_container_conf_folder)"
  docker rm -f ${CHE_SERVER_CONTAINER_NAME}
  rmdir ${CONF_FOLDER}

  # Then
  [ "$result" = "${CONF_FOLDER}" ]
}

@test "get container conf folder that is not set" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-container-conf-folder"
  docker run --name ${CHE_SERVER_CONTAINER_NAME} alpine:3.4 true

  # When
  result="$(get_che_container_conf_folder)"
  docker rm -f ${CHE_SERVER_CONTAINER_NAME}

  # Then
  [ "$result" = "not set" ]
}

@test "get container data folder" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-container-data-folder"
  DATA_FOLDER=$(pwd)/che-test-data
  mkdir ${DATA_FOLDER}
  docker run --name ${CHE_SERVER_CONTAINER_NAME} -v ${DATA_FOLDER}:/home/user/che/workspaces/ alpine:3.4 true

  # When
  result="$(get_che_container_data_folder)"
  docker rm -f ${CHE_SERVER_CONTAINER_NAME}
  rmdir ${DATA_FOLDER}

  # Then
  [ "$result" = "${DATA_FOLDER}" ]
}

@test "get image name" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-container-image-name"
  docker run --name ${CHE_SERVER_CONTAINER_NAME} alpine:3.4 true

  # When
  result="$(get_che_container_image_name)"
  docker rm -f ${CHE_SERVER_CONTAINER_NAME}

  # Then
  [ "$result" = "alpine:3.4" ]
}

@test "get che server container id" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-container-id"
  long_id=$(docker run -d --name ${CHE_SERVER_CONTAINER_NAME} alpine:3.4 true)
  short_id=${long_id:0:12}

  # When
  result="$(get_che_server_container_id)"
  docker rm -f ${CHE_SERVER_CONTAINER_NAME}

  # Then
  [ "$result" = "$short_id" ]
}

@test "get docker daemon version" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-docker-version"

  # When
  result="$(get_docker_daemon_version)"

  # Then
  [ "$result" ]
}

@test "get docker host os" {
  # Given
  export CHE_SERVER_CONTAINER_NAME="che-test-get-docker-host-os"

  # When
  result="$(get_docker_host_os)"

  # Then
  [ "$result" ]
}

@codenvy-ci
Copy link

@TylerJewell
Copy link
Author

@l0rd @garagatyi - made fixes. Also, I included a fix for this issue.
#1924

@codenvy-ci
Copy link

Build # 1324 - FAILED

Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/1324/ to view the results.

@@ -184,7 +224,7 @@ wait_until_container_is_stopped() {
}

server_is_booted() {
HTTP_STATUS_CODE=$(curl -I http://"${CHE_HOST_IP}":"${CHE_PORT}"/api/ \
HTTP_STATUS_CODE=$(curl -I http://$(docker inspect -f '{{.NetworkSettings.IPAddress}}' che-server):8080/api/ \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you would better replace che-server with ${CHE_SERVER_CONTAINER_NAME}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@l0rd
Copy link
Contributor

l0rd commented Jul 27, 2016

Aside my last comment LGTM

@TylerJewell TylerJewell merged commit f09a05d into master Jul 27, 2016
@TylerJewell TylerJewell deleted the CHE-1951 branch July 27, 2016 18:12
tolusha pushed a commit that referenced this pull request Aug 4, 2016
* Added more debug info

* update tests

* debug changes

* fix container server
ShimonBenYair pushed a commit to ShimonBenYair/che that referenced this pull request Aug 4, 2016
* Added more debug info

* update tests

* debug changes

* fix container server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants