PATH:
usr
/
lib
/
python2.7
/
site-packages
/
azurelinuxagent
/
common
# Microsoft Azure Linux Agent # # Copyright 2019 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Requires Python 2.6+ and Openssl 1.0+ # from azurelinuxagent.common.exception import ProtocolError import azurelinuxagent.common.logger as logger # pylint: disable=W0105 """ Base class for data contracts between guest and host and utilities to manipulate the properties in those contracts """ # pylint: enable=W0105 class DataContract(object): pass class DataContractList(list): def __init__(self, item_cls): # pylint: disable=W0231 self.item_cls = item_cls def validate_param(name, val, expected_type): if val is None: raise ProtocolError("{0} is None".format(name)) if not isinstance(val, expected_type): raise ProtocolError(("{0} type should be {1} not {2}" "").format(name, expected_type, type(val))) def set_properties(name, obj, data): if isinstance(obj, DataContract): validate_param("Property '{0}'".format(name), data, dict) for prob_name, prob_val in data.items(): prob_full_name = "{0}.{1}".format(name, prob_name) try: prob = getattr(obj, prob_name) except AttributeError: logger.warn("Unknown property: {0}", prob_full_name) continue prob = set_properties(prob_full_name, prob, prob_val) setattr(obj, prob_name, prob) return obj elif isinstance(obj, DataContractList): validate_param("List '{0}'".format(name), data, list) for item_data in data: item = obj.item_cls() item = set_properties(name, item, item_data) obj.append(item) return obj else: return data def get_properties(obj): if isinstance(obj, DataContract): data = {} props = vars(obj) for prob_name, prob in list(props.items()): data[prob_name] = get_properties(prob) return data elif isinstance(obj, DataContractList): data = [] for item in obj: item_data = get_properties(item) data.append(item_data) return data else: return obj
[+]
..
[-] __init__.py
[edit]
[-] conf.py
[edit]
[-] dhcp.py
[edit]
[-] event.py
[edit]
[-] exception.py
[edit]
[-] future.py
[edit]
[-] logger.py
[edit]
[+]
osutil
[+]
protocol
[-] rdma.py
[edit]
[+]
utils
[-] version.py
[edit]
[-] interfaces.py
[edit]
[-] __init__.pyc
[edit]
[-] __init__.pyo
[edit]
[-] conf.pyc
[edit]
[-] conf.pyo
[edit]
[-] agent_supported_feature.pyc
[edit]
[-] dhcp.pyc
[edit]
[-] dhcp.pyo
[edit]
[-] agent_supported_feature.pyo
[edit]
[-] event.pyc
[edit]
[-] event.pyo
[edit]
[-] logcollector.py
[edit]
[-] exception.pyc
[edit]
[-] exception.pyo
[edit]
[-] future.pyc
[edit]
[-] future.pyo
[edit]
[-] logger.pyc
[edit]
[-] logger.pyo
[edit]
[-] rdma.pyc
[edit]
[-] rdma.pyo
[edit]
[-] version.pyc
[edit]
[-] version.pyo
[edit]
[-] cgroup.py
[edit]
[-] cgroupapi.py
[edit]
[-] cgroupconfigurator.py
[edit]
[-] cgroupstelemetry.py
[edit]
[-] datacontract.py
[edit]
[-] errorstate.py
[edit]
[-] telemetryevent.py
[edit]
[-] cgroup.pyc
[edit]
[-] cgroup.pyo
[edit]
[-] logcollector_manifests.py
[edit]
[-] cgroupapi.pyc
[edit]
[-] cgroupapi.pyo
[edit]
[-] persist_firewall_rules.pyo
[edit]
[-] cgroupconfigurator.pyc
[edit]
[-] cgroupconfigurator.pyo
[edit]
[-] agent_supported_feature.py
[edit]
[-] cgroupstelemetry.pyc
[edit]
[-] cgroupstelemetry.pyo
[edit]
[-] persist_firewall_rules.py
[edit]
[-] datacontract.pyc
[edit]
[-] datacontract.pyo
[edit]
[-] singletonperthread.py
[edit]
[-] errorstate.pyc
[edit]
[-] errorstate.pyo
[edit]
[-] AgentGlobals.pyo
[edit]
[-] AgentGlobals.pyc
[edit]
[-] telemetryevent.pyc
[edit]
[-] telemetryevent.pyo
[edit]
[-] AgentGlobals.py
[edit]
[-] interfaces.pyc
[edit]
[-] interfaces.pyo
[edit]
[-] singletonperthread.pyo
[edit]
[-] logcollector.pyc
[edit]
[-] logcollector.pyo
[edit]
[-] persist_firewall_rules.pyc
[edit]
[-] logcollector_manifests.pyc
[edit]
[-] logcollector_manifests.pyo
[edit]
[-] singletonperthread.pyc
[edit]