def __init__(self, cert_path, key_path, insecure=False, proxy_configuration=None): self.cert_path = cert_path self.key_path = key_path self.insecure = insecure self.proxy_configuration = proxy_configuration # validate presence of cert/key in case they were removed after process creation if (cert_path is not None and not os.path.isfile(self.cert_path)) or \ (key_path is not None and not os.path.isfile(self.key_path)): print(cert_path) raise Exception("Invalid certificate or key file path.") self.default_headers = { self.ACCEPT_HEADER_KEY: self.APP_JSON_HEADER_VALUE, self.CONNECTION_HEADER_KEY: self.KEEP_ALIVE_HEADER_VALUE, self.USER_AGENT_HEADER_KEY: "AzureAutomationHybridWorker/" + configuration.get_worker_version() } self.json = serializerfactory.get_serializer(sys.version_info)
def __init__(self, status_code, raw_response_data=None): self.status_code = int(status_code) self.raw_data = raw_response_data self.json = serializerfactory.get_serializer(sys.version_info) if raw_response_data is not None: try: self.deserialized_data = self.json.loads(self.raw_data) except ValueError: self.deserialized_data = None
def __init__(self, status_code, raw_response_data=None): self.status_code = int(status_code) self.raw_data = raw_response_data self.json = serializerfactory.get_serializer(sys.version_info) if raw_response_data is not None: try: self.deserialized_data = self.json.loads(self.raw_data) except ValueError: import tracer self.deserialized_data = None service_unavailable_check_result = self.check_if_service_unavailable_response_is_received(self.raw_data) if service_unavailable_check_result is not None: tracer.log_warning_trace("Request to service failed because the service was unavailable. Detailed response is %s" %(service_unavailable_check_result))
def __init__(self, cert_path, key_path, insecure=False): self.cert_path = cert_path self.key_path = key_path self.insecure = insecure if (cert_path is not None and not os.path.isfile(self.cert_path)) or \ (key_path is not None and not os.path.isfile(self.key_path)): print cert_path raise Exception("Invalid certificate or key file path.") self.default_headers = {self.ACCEPT_HEADER_KEY: self.APP_JSON_HEADER_VALUE, self.CONNECTION_HEADER_KEY: self.KEEP_ALIVE_HEADER_VALUE, self.USER_AGENT_HEADER_KEY: "AzureAutomationHybridWorker/" + configuration.get_worker_version()} self.json = serializerfactory.get_serializer(sys.version_info)
def __init__(self, cert_path, key_path, insecure=False, proxy_configuration=None): self.cert_path = cert_path self.key_path = key_path self.insecure = insecure self.proxy_configuration = proxy_configuration # validate presence of cert/key in case they were removed after process creation if (cert_path is not None and not os.path.isfile(self.cert_path)) or \ (key_path is not None and not os.path.isfile(self.key_path)): print(cert_path) raise Exception("Invalid certificate or key file path.") self.default_headers = {self.ACCEPT_HEADER_KEY: self.APP_JSON_HEADER_VALUE, self.CONNECTION_HEADER_KEY: self.KEEP_ALIVE_HEADER_VALUE } self.json = serializerfactory.get_serializer(sys.version_info)
def __init__(self, cert_path, key_path, insecure=False): self.cert_path = cert_path self.key_path = key_path self.insecure = insecure if (cert_path is not None and not os.path.isfile(self.cert_path)) or \ (key_path is not None and not os.path.isfile(self.key_path)): print cert_path raise Exception("Invalid certificate or key file path.") self.default_headers = { self.ACCEPT_HEADER_KEY: self.APP_JSON_HEADER_VALUE, self.CONNECTION_HEADER_KEY: self.KEEP_ALIVE_HEADER_VALUE, self.USER_AGENT_HEADER_KEY: "AzureAutomationHybridWorker/" + configuration.get_worker_version() } self.json = serializerfactory.get_serializer(sys.version_info)
# # Copyright (C) Microsoft Corporation, All rights reserved. """Runtime module. Contains runtime base class and language specific runtime classes.""" import signal import subprocess import sys import time from distutils.spawn import find_executable import serializerfactory import subprocessfactory from runbook import * from workerexception import * json = serializerfactory.get_serializer(sys.version_info) class Runtime: """Runtime base class.""" def __init__(self, job_data, runbook): # should be overwritten by language runtime self.execution_alias = None self.base_cmd = None # used for actual runtime self.runbook = runbook self.runbook_subprocess = None self.job_data = job_data def initialize(self):
#!/usr/bin/env python2 # # Copyright (C) Microsoft Corporation, All rights reserved. import ConfigParser import os import sys import serializerfactory json = serializerfactory.get_serializer(sys.version_info) CONFIG_ENV_KEY = "WORKERCONF" WORKER_REQUIRED_CONFIG_SECTION = "worker-required" OPTIONAL_CONFIG_SECTION = "worker-optional" # manually set configuration values SOURCE_DIRECTORY_PATH = "source_directory_path" COMPONENT = "component" # required configuration keys CERT_PATH = "jrds_cert_path" KEY_PATH = "jrds_key_path" BASE_URI = "jrds_base_uri" ACCOUNT_ID = "account_id" MACHINE_ID = "machine_id" HYBRID_WORKER_GROUP_NAME = "hybrid_worker_group_name" WORKER_VERSION = "worker_version" WORKING_DIRECTORY_PATH = "working_directory_path" # optional configuration keys