Skip to content

Commit

Permalink
Re-naming NICE DCV to Amazon DCV
Browse files Browse the repository at this point in the history
  • Loading branch information
Himani Deshpande committed Nov 19, 2024
1 parent 95e480e commit 4a2e0fe
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_token_info(self, token):

class DCVAuthenticator(BaseHTTPRequestHandler):
"""
Simple HTTP server to handle NICE DCV authentication process.
Simple HTTP server to handle Amazon DCV authentication process.
The authentication process to access to a DCV session is performed by the following steps:
1. Obtain a Request Token:
Expand Down Expand Up @@ -191,7 +191,7 @@ def do_GET(self): # noqa N802, pylint: disable=C0103

def do_POST(self): # noqa N802 pylint: disable=C0103
"""
Handle POST requests, coming from NICE DCV server.
Handle POST requests, coming from Amazon DCV server.
The format of the request is the following:
curl -k http://localhost:<port> -d sessionId=<session-id> -d authenticationToken=<token>
Expand Down Expand Up @@ -360,7 +360,7 @@ def _is_session_valid(user, session_id):
# because currently DCV doesn't allow list-session to list all session even for non-root user.
# TODO change this method if DCV updates his behaviour.
"""
logger.info("Verifying NICE DCV session validity..")
logger.info("Verifying Amazon DCV session validity..")
# Remove the first and the last because they are the heading and empty, respectively
# All commands and arguments in this subprocess call are built as literals
processes = subprocess.check_output(["/bin/ps", "aux"]).decode("utf-8").split("\n")[1:-1] # nosec B603
Expand All @@ -370,7 +370,7 @@ def _is_session_valid(user, session_id):
filter(lambda process: DCVAuthenticator.check_dcv_process(process, user, session_id), processes), None
):
raise DCVAuthenticator.IncorrectRequestError("The given session does not exists")
logger.info("The NICE DCV session is valid.")
logger.info("The Amazon DCV session is valid.")

@staticmethod
def _verify_session_existence(user, session_id):
Expand Down Expand Up @@ -402,9 +402,9 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):

def _run_server(port, certificate=None, key=None):
"""
Run NICE DCV authenticator server on localhost.
Run Amazon DCV authenticator server on localhost.
The NICE DCV authenticator server *must* run with an appropriate user.
The Amazon DCV authenticator server *must* run with an appropriate user.
:param port: the port in which you want to start the server
:param certificate: the certificate to use if HTTPSs
Expand Down Expand Up @@ -497,12 +497,12 @@ def main():
global logger # pylint: disable=C0103,W0603
logger = _config_logger()
try:
logger.info("Starting NICE DCV authenticator server")
logger.info("Starting Amazon DCV authenticator server")
args = _parse_args()
_prepare_auth_folder()
_run_server(port=args.port if args.port else 8444, certificate=args.certificate, key=args.key)
except KeyboardInterrupt:
logger.info("Closing NICE DCV authenticator server")
logger.info("Closing Amazon DCV authenticator server")
except Exception as e:
fail(f"Unexpected error of type {type(e).__name__}: {e}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ _create_dcv_session() {
dcv_session_file="$1"
shared_folder_path="$2"

_log "Creating a new NICE DCV session..."
_log "Creating a new Amazon DCV session..."
# Generate a random session id
sessionid=$(shuf -zer -n20 {A..Z} {a..z} {0..9})
echo "${sessionid}" > "${dcv_session_file}"
dcv create-session --type virtual --storage-root "${shared_folder_path}" "${sessionid}"
_log "NICE DCV session created successfully."
_log "Amazon DCV session created successfully."

echo "${sessionid}"
}

main() {
_log "--- Initializing NICE DCV authentication... ---"
_log "--- Initializing Amazon DCV authentication... ---"

if [[ -z "$1" ]]; then
_fail "The script requires the shared folder as input parameter."
Expand All @@ -117,7 +117,7 @@ main() {
fi

if ! systemctl is-active --quiet dcvserver; then
_fail "NICE DCV service is not active on the given instance."
_fail "Amazon DCV service is not active on the given instance."
fi

# Create a session with session storage enabled.
Expand All @@ -127,7 +127,7 @@ main() {
sessionid=$(_create_dcv_session "${dcv_session_file}" "${shared_folder_path}")
else
sessionid=$(cat "${dcv_session_file}")
_log "Reusing existing NICE DCV session for the current user."
_log "Reusing existing Amazon DCV session for the current user."

# number of session can either be 0 or 1
number_of_sessions=$(dcv list-sessions |& grep "${user}" | grep -c "${sessionid}")
Expand All @@ -145,7 +145,7 @@ main() {
# Retrieve Request Token and Access File name
_log "Retrieving Request Token and Access File name.."
user_token_request=$(/usr/bin/curl --retry 3 --max-time 5 -s -k -X GET -G "https://localhost:${ext_auth_port}" -d action=requestToken -d authUser="${user}" -d sessionID="${sessionid}")
_validate_json "${user_token_request}" "Unable to obtain the Request Token from the NICE DCV external authenticator."
_validate_json "${user_token_request}" "Unable to obtain the Request Token from the Amazon DCV external authenticator."
request_token=$(echo "${user_token_request}" | jq -r .requestToken)
access_file=$(echo "${user_token_request}" | jq -r .accessFile)
_log "Request Token and Access File name obtained successfully."
Expand All @@ -160,15 +160,15 @@ main() {
# Retrieve Session Token
_log "Retrieving Session Token.."
session_token_request=$(/usr/bin/curl --retry 3 --max-time 5 -s -k -X GET -G "https://localhost:${ext_auth_port}" -d action=sessionToken -d requestToken="${request_token}")
_validate_json "${session_token_request}" "Unable to obtain the Session Token from the NICE DCV external authenticator."
_validate_json "${session_token_request}" "Unable to obtain the Session Token from the Amazon DCV external authenticator."
session_token=$(echo "${session_token_request}" | jq -r .sessionToken)
_log "Session Token obtained successfully."

if [[ -z "${dcv_server_port}" ]]; then
dcv_server_port=8443
fi

_log "--- NICE DCV authentication performed successfully. ---"
_log "--- Amazon DCV authentication performed successfully. ---"
echo "PclusterDcvServerPort=${dcv_server_port} PclusterDcvSessionId=${sessionid} PclusterDcvSessionToken=${session_token}"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def post_install
# empty by default
end

# Configure the system to enable NICE DCV to have direct access to the Linux server's GPU and enable GPU sharing.
# Configure the system to enable Amazon DCV to have direct access to the Linux server's GPU and enable GPU sharing.
def allow_gpu_acceleration
# Update the xorg.conf to set up NVIDIA drivers.
# NOTE: --enable-all-gpus parameter is needed to support servers with more than one NVIDIA GPU.
Expand Down Expand Up @@ -124,14 +124,14 @@ def optionally_disable_rnd
if dcv_supported?
# Setup dcv authenticator group
group node['cluster']['dcv']['authenticator']['group'] do
comment 'NICE DCV External Authenticator group'
comment 'Amazon DCV External Authenticator group'
gid node['cluster']['dcv']['authenticator']['group_id']
system true
end

# Setup dcv authenticator user
user node['cluster']['dcv']['authenticator']['user'] do
comment 'NICE DCV External Authenticator user'
comment 'Amazon DCV External Authenticator user'
uid node['cluster']['dcv']['authenticator']['user_id']
gid node['cluster']['dcv']['authenticator']['group_id']
# home is mounted from the head node
Expand Down Expand Up @@ -247,7 +247,7 @@ def optionally_disable_rnd
mode '0700'
end

# Start NICE DCV server
# Start Amazon DCV server
service "dcvserver" do
action %i(enable start)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ def self.nothing(chef_run)

it 'sets up dcv authenticator group' do
is_expected.to create_group(authenticator_group).with(
comment: 'NICE DCV External Authenticator group',
comment: 'Amazon DCV External Authenticator group',
gid: authenticator_group_id,
system: true
)
end

it 'sets up dcv authenticator user' do
is_expected.to create_user(authenticator_user).with(
comment: 'NICE DCV External Authenticator user',
comment: 'Amazon DCV External Authenticator user',
gid: authenticator_group_id,
uid: authenticator_user_id,
manage_home: true,
Expand Down Expand Up @@ -884,7 +884,7 @@ def self.nothing(chef_run)
)
end

it 'starts NICE DCV server' do
it 'starts Amazon DCV server' do
is_expected.to enable_service('dcvserver').with_action(%i(enable start))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
it { should exist }
its('uid') { should eq node['cluster']['dcv']['authenticator']['user_id'] }
its('gid') { should eq node['cluster']['dcv']['authenticator']['group_id'] }
# 'NICE DCV External Authenticator user'
# 'Amazon DCV External Authenticator user'
end

describe group(node['cluster']['dcv']['authenticator']['group']) do
Expand Down

0 comments on commit 4a2e0fe

Please sign in to comment.