def validateSetMembership(s): """ Return an Eliot validator that requires values to be elements of ``s``. """ def validator(v): if v not in s: raise ValidationError("{} not in {}".format(v, s)) return validator RELPATH = Field.for_types( u"relpath", [unicode], u"The relative path of a file in a magic-folder.", ) VERSION = Field.for_types( u"version", [int, long], u"The version of the file.", ) LAST_UPLOADED_URI = Field.for_types( u"last_uploaded_uri", [unicode, bytes, None], u"The filecap to which this version of this file was uploaded.", )
dictionary = dictionary.copy() dictionary.pop(_CLASS_MARKER) return _CONFIG_CLASS_MAP[class_name].create(dictionary) else: return dictionary return loads(data, object_hook=decode) _DEPLOYMENT_FIELD = Field(u"configuration", repr) _LOG_STARTUP = MessageType(u"flocker-control:persistence:startup", [_DEPLOYMENT_FIELD]) _LOG_SAVE = ActionType(u"flocker-control:persistence:save", [_DEPLOYMENT_FIELD], []) _UPGRADE_SOURCE_FIELD = Field.for_types( u"source_version", [int], u"Configuration version to upgrade from.") _UPGRADE_TARGET_FIELD = Field.for_types( u"target_version", [int], u"Configuration version to upgrade to.") _LOG_UPGRADE = ActionType(u"flocker-control:persistence:migrate_configuration", [ _DEPLOYMENT_FIELD, _UPGRADE_SOURCE_FIELD, _UPGRADE_TARGET_FIELD, ], []) class LeaseService(Service): """ Manage leases. In particular, clear out expired leases once a second.
from twisted.internet.defer import succeed, fail from twisted.internet.threads import deferToThread from twisted.web.http import NOT_FOUND, INTERNAL_SERVER_ERROR from ..common import ( poll_until, retry_if, decorate_methods, with_retry, get_default_retry_steps, ) from ..control._model import ( RestartNever, RestartAlways, RestartOnFailure, pset_field, pvector_field) LOG_CACHED_IMAGE = MessageType( u"flocker:node:docker:image_from_cache", [Field.for_types(u"image", [unicode], "The image ID.")], "An image was retrieved from the cache." ) class AlreadyExists(Exception): """A unit with the given name already exists.""" @with_cmp(["address", "apierror"]) class AddressInUse(Exception): """ The listen address for an exposed port was in use and could not be bound. """ def __init__(self, address, apierror): """
from twisted.web.http import NOT_FOUND, INTERNAL_SERVER_ERROR from ..common import ( poll_until, retry_if, decorate_methods, with_retry, get_default_retry_steps, ) from ..control._model import (RestartNever, RestartAlways, RestartOnFailure, pset_field, pvector_field) LOG_CACHED_IMAGE = MessageType( u"flocker:node:docker:image_from_cache", [Field.for_types(u"image", [unicode], "The image ID.")], "An image was retrieved from the cache.") class AlreadyExists(Exception): """A unit with the given name already exists.""" @with_cmp(["address", "apierror"]) class AddressInUse(Exception): """ The listen address for an exposed port was in use and could not be bound. """ def __init__(self, address, apierror): """ :param tuple address: The conventional Python representation of the
from twisted.internet.error import ConnectionDone from twisted.protocols.basic import LineOnlyReceiver from twisted.python.filepath import FilePath import os from ...common import loop_until, timeout from ._model import ( Run, Sudo, Put, Comment, RunRemotely, perform_comment, perform_put, perform_sudo) from .._effect import dispatcher as base_dispatcher RUN_OUTPUT_MESSAGE = MessageType( message_type="flocker.provision.ssh:run:output", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) def extReceived(self, type, data): from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR if type == EXTENDED_DATA_STDERR: self.dataReceived(data) @attributes([ "deferred", "context", ])
# Copyright ClusterHQ Inc. See LICENSE file for details. from eliot import Field, MessageType CINDER_VOLUME = MessageType( u"flocker:functional:cinder:cinder_volume:created", [ Field.for_types( u"id", [bytes, unicode], u"The Cinder-assigned unique identifier for the volume that was " u"created.", ) ], )
# Copyright ClusterHQ Ltd. See LICENSE file for details. from eliot import Field, MessageType CINDER_VOLUME = MessageType( u"flocker:functional:cinder:cinder_volume:created", [Field.for_types( u"id", [bytes, unicode], u"The Cinder-assigned unique identifier for the volume that was " u"created.", )], )
import os from collections import defaultdict from characteristic import attributes from eliot import MessageType, ActionType, Field from eliot.twisted import DeferredContext from twisted.internet.error import ProcessDone from twisted.internet.defer import Deferred from twisted.internet.protocol import ProcessProtocol from twisted.protocols.basic import LineOnlyReceiver RUN_ACTION = ActionType( action_type="admin.runner:run", startFields=[Field.for_types(u"command", [list], u"The command.")], successFields=[], description="Run a command.", ) RUN_OUTPUT_MESSAGE = MessageType( message_type="admin.runner:run:output", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) # LineOnlyReceiver is mutable, so can't use pyrsistent @attributes([ "handle_line",
See https://clusterhq.atlassian.net/browse/FLOC-2053 for consolidation opportunities. """ from eliot import Field, ActionType, MessageType # Begin: Common structures used by all (AWS, OpenStack) # storage drivers. DATASET_ID = Field(u"dataset_id", lambda dataset_id: unicode(dataset_id), u"The unique identifier of a dataset.") # An OPERATION is a list of: # IBlockDeviceAPI name, positional arguments, keyword arguments. OPERATION = Field.for_types( u"operation", [list], u"The IBlockDeviceAPI operation being executed," u"along with positional and keyword arguments.") COUNT = Field.for_types(u"count", [int], u"Count of operation calls.") # End: Common structures used by all storage drivers. # Begin: Helper datastructures to log IBlockDeviceAPI calls # from AWS storage driver using Eliot. # ActionType used by AWS storage driver. AWS_ACTION = ActionType( u"flocker:node:agents:blockdevice:aws", [OPERATION, COUNT], [], u"An IBlockDeviceAPI operation is executing using AWS storage driver.") # Three fields to gather from EC2 response to Boto.
from twisted.internet.endpoints import UNIXClientEndpoint, connectProtocol from twisted.internet.error import ConnectionDone from twisted.protocols.basic import LineOnlyReceiver from twisted.python.filepath import FilePath import os from ...common import loop_until, timeout from ._model import (Run, Sudo, Put, Comment, RunRemotely, perform_comment, perform_put, perform_sudo) from .._effect import dispatcher as base_dispatcher RUN_OUTPUT_MESSAGE = MessageType( message_type="flocker.provision.ssh:run:output", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) def extReceived(self, type, data): from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR if type == EXTENDED_DATA_STDERR: self.dataReceived(data) @attributes([ "deferred", "context", ])
CALLBACK, validateInstanceOf, ) from . import _watchdog_541 _watchdog_541.patch() NOT_STARTED = "NOT_STARTED" STARTED = "STARTED" STOPPING = "STOPPING" STOPPED = "STOPPED" _PATH = Field.for_types( u"path", [bytes, unicode], u"The path an inotify event concerns.", ) _EVENT = Field( u"event", lambda e: e.__class__.__name__, u"The watchdog event that has taken place.", validateInstanceOf(FileSystemEvent), ) ANY_INOTIFY_EVENT = ActionType( u"watchdog:inotify:any-event", [_PATH, _EVENT], [], u"An inotify event is being dispatched.",
LOG_JWS_SIGN = ActionType(u'txacme:jws:sign', fields(NONCE, key_type=unicode, alg=unicode), fields(), u'Signing a message with JWS') LOG_JWS_HEAD = ActionType(u'txacme:jws:http:head', fields(), fields(), u'A JWSClient HEAD request') LOG_JWS_GET = ActionType(u'txacme:jws:http:get', fields(), fields(), u'A JWSClient GET request') LOG_JWS_POST = ActionType(u'txacme:jws:http:post', fields(), fields(), u'A JWSClient POST request') LOG_JWS_REQUEST = ActionType( u'txacme:jws:http:request', fields(url=unicode), fields(Field.for_types(u'content_type', [unicode, None], u'Content-Type header field'), code=int), u'A JWSClient request') LOG_JWS_CHECK_RESPONSE = ActionType( u'txacme:jws:http:check-response', fields(Field.for_types(u'response_content_type', [unicode, None], u'Content-Type header field'), expected_content_type=unicode), fields(), u'Checking a JWSClient response') LOG_JWS_GET_NONCE = ActionType(u'txacme:jws:nonce:get', fields(), fields(NONCE), u'Consuming a nonce') LOG_JWS_ADD_NONCE = ActionType( u'txacme:jws:nonce:add', fields(Field.for_types(u'raw_nonce', [bytes, None],
# here, though. It sill does not allow the path to "jump out" # of the base magic_path -- that is, an InsecurePath error # will result if you pass an absolute path outside the folder # or a relative path that reaches up too far. try: path = self.config.magic_path.preauthChild(relative_path) except InsecurePath as e: return defer.fail(APIError.from_exception(http.NOT_ACCEPTABLE, e)) mf = self.file_factory.magic_file_for(path) d = mf.create_update() return d _NICKNAME = Field.for_types( u"nickname", [str, bytes], u"A Magic-Folder participant nickname.", ) _DIRECTION = Field.for_types( u"direction", [str], u"A synchronization direction: uploader or downloader.", validateSetMembership({u"uploader", u"downloader"}), ) PROCESSING_LOOP = ActionType( u"magic-folder:processing-loop", [_NICKNAME, _DIRECTION], [], u"A Magic-Folder is processing uploads or downloads.",
LOG_START_SERVICE = ActionType( u'fusion_index:service:start', [_SERVICE_DESCRIPTION], [], u'Indexing service is starting') LOG_STOP_SERVICE = ActionType( u'fusion_index:service:stop', [], [], u'Indexing service is stopping') LOG_LOOKUP_GET = ActionType( u'fusion_index:lookup:get', fields(environment=unicode, indexType=unicode, key=unicode), [Field.for_types('value', [bytes, None], u'Value in the index, if any')], u'Retrieving a value from the lookup index') LOG_LOOKUP_PUT = ActionType( u'fusion_index:lookup:put', fields(environment=unicode, indexType=unicode, key=unicode), fields(value=bytes), u'Storing a value in the lookup index') _SEARCH_TYPE = Field.for_types( 'searchType', [unicode, None], u'The search type') LOG_SEARCH_GET = ActionType( u'fusion_index:search:get', fields(
from allmydata.util.netstring import netstring, split_netstring from allmydata.util.consumer import download_to_data from allmydata.uri import wrap_dirnode_cap from allmydata.util.dictutil import AuxValueDict from eliot import ( ActionType, Field, ) from eliot.twisted import ( DeferredContext, ) NAME = Field.for_types( u"name", [unicode], u"The name linking the parent to this node.", ) METADATA = Field.for_types( u"metadata", [dict], u"Data about a node.", ) OVERWRITE = Field.for_types( u"overwrite", [bool], u"True to replace an existing file of the same name, " u"false to fail with a collision error.", )
IN_MOVE_SELF, IN_UNMOUNT, IN_Q_OVERFLOW, IN_IGNORED, IN_ONLYDIR, IN_DONT_FOLLOW, \ IN_MASK_ADD, IN_ISDIR, IN_ONESHOT, IN_CLOSE, IN_MOVED, IN_CHANGED, \ _FLAG_TO_HUMAN from . import _watchdog_541 _watchdog_541.patch() NOT_STARTED = "NOT_STARTED" STARTED = "STARTED" STOPPING = "STOPPING" STOPPED = "STOPPED" _PATH = Field.for_types( u"path", [bytes, unicode], u"The path an inotify event concerns.", ) _EVENT = Field( u"event", lambda e: e.__class__.__name__, u"The watchdog event that has taken place.", validateInstanceOf(FileSystemEvent), ) ANY_INOTIFY_EVENT = ActionType( u"watchdog:inotify:any-event", [_PATH, _EVENT], [], u"An inotify event is being dispatched.",
u'txacme:jws:sign', fields(NONCE, key_type=unicode, alg=unicode, kid=unicode), fields(), u'Signing a message with JWS') LOG_JWS_HEAD = ActionType(u'txacme:jws:http:head', fields(), fields(), u'A JWSClient HEAD request') LOG_JWS_GET = ActionType(u'txacme:jws:http:get', fields(), fields(), u'A JWSClient GET request') LOG_JWS_POST = ActionType(u'txacme:jws:http:post', fields(), fields(), u'A JWSClient POST request') LOG_JWS_REQUEST = ActionType( u'txacme:jws:http:request', fields(url=unicode), fields(Field.for_types(u'content_type', [unicode, None], u'Content-Type header field'), code=int), u'A JWSClient request') LOG_JWS_CHECK_RESPONSE = ActionType( u'txacme:jws:http:check-response', fields(Field.for_types(u'response_content_type', [unicode, None], u'Content-Type header field'), expected_content_type=unicode), fields(), u'Checking a JWSClient response') LOG_JWS_GET_NONCE = ActionType(u'txacme:jws:nonce:get', fields(), fields(NONCE), u'Consuming a nonce') LOG_JWS_ADD_NONCE = ActionType( u'txacme:jws:nonce:add', fields(Field.for_types(u'raw_nonce', [bytes, None],
from characteristic import attributes from eliot import MessageType, ActionType, Field from eliot.twisted import DeferredContext from twisted.python.failure import Failure from twisted.internet.error import ProcessTerminated, ProcessDone from twisted.internet.defer import Deferred from twisted.internet.protocol import ProcessProtocol from twisted.protocols.basic import LineOnlyReceiver RUN_ACTION = ActionType( action_type="flocker.common.runner:run", startFields=[ Field.for_types(u"command", [list], u"The command.") ], successFields=[], description="Run a command.", ) RUN_OUTPUT_MESSAGE = MessageType( message_type="flocker.common.runner:run:stdout", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) RUN_ERROR_MESSAGE = MessageType( message_type="flocker.common.runner:run:stderr", fields=[ Field.for_types(u"line", [bytes], u"The error."),
from pipes import quote as shell_quote from characteristic import attributes from eliot import MessageType, ActionType, Field from eliot.twisted import DeferredContext from twisted.python.failure import Failure from twisted.internet.error import ProcessTerminated, ProcessDone from twisted.internet.defer import Deferred from twisted.internet.protocol import ProcessProtocol from twisted.protocols.basic import LineOnlyReceiver RUN_ACTION = ActionType( action_type="flocker.common.runner:run", startFields=[Field.for_types(u"command", [list], u"The command.")], successFields=[], description="Run a command.", ) RUN_OUTPUT_MESSAGE = MessageType( message_type="flocker.common.runner:run:stdout", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) RUN_ERROR_MESSAGE = MessageType( message_type="flocker.common.runner:run:stderr", fields=[ Field.for_types(u"line", [bytes], u"The error."), ],
from eliot import ActionType, Field, fields _SEARCH_CLASS = Field(u'searchClass', lambda c: c.value, u'The search class') LOG_LOOKUP_GET = ActionType( u'fusion_index:lookup:get', fields(environment=unicode, indexType=unicode, key=unicode), [Field.for_types('value', [bytes, None], u'Value in the index, if any')], u'Retrieving a value from the lookup index') LOG_LOOKUP_PUT = ActionType( u'fusion_index:lookup:put', fields(environment=unicode, indexType=unicode, key=unicode), fields(value=bytes), u'Storing a value in the lookup index') _SEARCH_TYPE = Field.for_types('searchType', [unicode, None], u'The search type') LOG_SEARCH_GET = ActionType( u'fusion_index:search:get', fields(_SEARCH_CLASS, _SEARCH_TYPE, environment=unicode, indexType=unicode, searchValue=unicode), fields(results=list), u'Searching the search index') LOG_SEARCH_PUT = ActionType( u'fusion_index:search:put', fields(_SEARCH_CLASS, environment=unicode, indexType=unicode,
from pyrsistent import PClass, field, InvariantException from testtools.matchers import Is, Equals, Raises, MatchesException from zope.interface import Interface, implementer from .. import ( interface_decorator, provides, validate_signature_against_kwargs, InvalidSignature, ) from ...testtools import TestCase # Eliot structures for testing ``interface_decorator``. METHOD = Field.for_types(u"method", [unicode], u"The name of the decorated method.") TEST_MESSAGE = MessageType(u"flocker:common:test:interface:message", [METHOD]) TEST_EXCEPTION = MessageType(u"flocker:common:test:interface:exception", [METHOD]) class IDummy(Interface): """ Dummy interface with two test methods. """ def return_method(): """ Return something. """ def raise_method():
OpenStack-related tools. """ # After _interface_decorator is public, move this and auto_openstack_logging # into (or at least nearer) flocker/node/agents/cinder.py. from eliot import Field, MessageType from novaclient.exceptions import ClientException as NovaClientException from keystoneclient.openstack.common.apiclient.exceptions import ( HttpError as KeystoneHttpError, ) from ._thread import _interface_decorator CODE = Field.for_types("code", [int], u"The HTTP response code.") MESSAGE = Field.for_types( "message", [bytes, unicode], u"A human-readable error message given by the response.", ) DETAILS = Field.for_types("details", [dict], u"Extra details about the error.") REQUEST_ID = Field.for_types( "request_id", [bytes, unicode], u"The unique identifier assigned by the server for this request.", ) URL = Field.for_types("url", [bytes, unicode], u"The request URL.") METHOD = Field.for_types("method", [bytes, unicode], u"The request method.") NOVA_CLIENT_EXCEPTION = MessageType( u"openstack:nova_client_exception", [ CODE,
if not isinstance(v, t): raise ValidationError("{} not an instance of {}".format(v, t)) return validator def validateSetMembership(s): """ Return an Eliot validator that requires values to be elements of ``s``. """ def validator(v): if v not in s: raise ValidationError("{} not in {}".format(v, s)) return validator RELPATH = Field.for_types( u"relpath", [unicode], u"The relative path of a file in a magic-folder.", ) VERSION = Field.for_types( u"version", [int, long], u"The version of the file.", ) LAST_UPLOADED_URI = Field.for_types( u"last_uploaded_uri", [unicode, bytes, None], u"The filecap to which this version of this file was uploaded.", )
""" Helper module to provide macros for logging support for storage drivers (AWS, Cinder). See https://clusterhq.atlassian.net/browse/FLOC-2053 for consolidation opportunities. """ from eliot import Field, ActionType, MessageType # Begin: Common structures used by all (AWS, OpenStack) # storage drivers. # An OPERATION is a list of: # IBlockDeviceAPI name, positional arguments, keyword arguments. OPERATION = Field.for_types( u"operation", [list], u"The IBlockDeviceAPI operation being executed," u"along with positional and keyword arguments.") # End: Common structures used by all storage drivers. # Begin: Helper datastructures to log IBlockDeviceAPI calls # from AWS storage driver using Eliot. # ActionType used by AWS storage driver. AWS_ACTION = ActionType( u"flocker:node:agents:blockdevice:aws", [OPERATION], [], u"An IBlockDeviceAPI operation is executing using AWS storage driver.") # Three fields to gather from EC2 response to Boto.
from twisted.trial.unittest import SynchronousTestCase from eliot.testing import ( assertHasMessage, capture_logging ) from eliot import Field, MessageType from zope.interface import Interface, implementer from .. import interface_decorator # Eliot structures for testing ``interface_decorator``. METHOD = Field.for_types( u"method", [unicode], u"The name of the decorated method.") TEST_MESSAGE = MessageType(u"flocker:common:test:interface:message", [METHOD]) TEST_EXCEPTION = MessageType(u"flocker:common:test:interface:exception", [METHOD]) class IDummy(Interface): """ Dummy interface with two test methods. """ def return_method(): """ Return something. """
) from eliot.testing import ( swap_logger, check_for_errors, ) from twisted.python.monkey import ( MonkeyPatcher, ) from ..util.jsonbytes import AnyBytesJSONEncoder _NAME = Field.for_types( u"name", [str], u"The name of the test.", ) RUN_TEST = ActionType( u"run-test", [_NAME], [], u"A test is run.", ) # On Python 3, we want to use our custom JSON encoder when validating messages # can be encoded to JSON: if PY2: _memory_logger = MemoryLogger
import attr from eliot import ( ActionType, Field, ) from eliot.testing import capture_logging from twisted.internet.defer import ( maybeDeferred, ) _NAME = Field.for_types( u"name", [unicode], u"The name of the test.", ) RUN_TEST = ActionType( u"run-test", [_NAME], [], u"A test is run.", ) def eliot_logged_test(f): """ Decorate a test method to run in a dedicated Eliot action context.
lambda v: None if v is None else { "size": v.size, "mtime_ns": v.mtime_ns, "ctime_ns": v.ctime_ns, "version": v.version, "last_uploaded_uri": v.last_uploaded_uri, "last_downloaded_uri": v.last_downloaded_uri, "last_downloaded_timestamp": v.last_downloaded_timestamp, }, u"The local database state of a file.", validateInstanceOf((type(None), PathEntry)), ) _INSERT_OR_UPDATE = Field.for_types( u"insert_or_update", [unicode], u"An indication of whether the record for this upload was new or an update to a previous entry.", validateSetMembership({u"insert", u"update"}), ) UPDATE_ENTRY = ActionType( u"magic-folder-db:update-entry", [RELPATH, VERSION, LAST_UPLOADED_URI, LAST_DOWNLOADED_URI, LAST_DOWNLOADED_TIMESTAMP, PATHINFO], [_INSERT_OR_UPDATE], u"Record some metadata about a relative path in the magic-folder.", ) # magic-folder db schema version 1 SCHEMA_v1 = """ CREATE TABLE version (
dictionary = dictionary.copy() dictionary.pop(_CLASS_MARKER) return _CONFIG_CLASS_MAP[class_name].create(dictionary) else: return dictionary return loads(data, object_hook=decode) _DEPLOYMENT_FIELD = Field(u"configuration", repr) _LOG_STARTUP = MessageType(u"flocker-control:persistence:startup", [_DEPLOYMENT_FIELD]) _LOG_SAVE = ActionType(u"flocker-control:persistence:save", [_DEPLOYMENT_FIELD], []) _UPGRADE_SOURCE_FIELD = Field.for_types( u"source_version", [int], u"Configuration version to upgrade from.") _UPGRADE_TARGET_FIELD = Field.for_types( u"target_version", [int], u"Configuration version to upgrade to.") _LOG_UPGRADE = ActionType(u"flocker-control:persistence:migrate_configuration", [_DEPLOYMENT_FIELD, _UPGRADE_SOURCE_FIELD, _UPGRADE_TARGET_FIELD, ], []) _LOG_EXPIRE = MessageType( u"flocker-control:persistence:lease-expired", [Field(u"dataset_id", unicode), Field(u"node_id", unicode)], u"A lease for a dataset has expired.") _LOG_UNCHANGED_DEPLOYMENT_NOT_SAVED = MessageType( u"flocker-control:persistence:unchanged-deployment-not-saved", [], u"The persistence service was told to save a deployment which is the same " u"as the already-saved deployment. It has optimized this away."
from characteristic import attributes from eliot import MessageType, ActionType, Field from eliot.twisted import DeferredContext from twisted.python.failure import Failure from twisted.internet.error import ProcessTerminated, ProcessDone from twisted.internet.defer import Deferred from twisted.internet.protocol import ProcessProtocol from twisted.protocols.basic import LineOnlyReceiver RUN_ACTION = ActionType( action_type="flocker.common.runner:run", startFields=[ Field.for_types(u"command", [list], u"The command.") ], successFields=[], description="Run a command.", ) RUN_OUTPUT_MESSAGE = MessageType( message_type="flocker.common.runner:run:stdout", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) RUN_ERROR_MESSAGE = MessageType( message_type="flocker.common.runner:run:stderr", fields=[ Field.for_types(u"line", [bytes], u"The error."),
from allmydata.util.consumer import download_to_data from allmydata.uri import wrap_dirnode_cap from allmydata.util.dictutil import AuxValueDict from eliot import ( ActionType, Field, ) from eliot.twisted import ( DeferredContext, ) NAME = Field.for_types( u"name", # Make sure this works on Python 2; with str, it gets Future str which # breaks Eliot. [unicode], u"The name linking the parent to this node.", ) METADATA = Field.for_types( u"metadata", [dict], u"Data about a node.", ) OVERWRITE = Field.for_types( u"overwrite", [bool], u"True to replace an existing file of the same name, " u"false to fail with a collision error.",
from characteristic import attributes from eliot import MessageType, ActionType, Field from eliot.twisted import DeferredContext from twisted.python.failure import Failure from twisted.internet.error import ProcessTerminated, ProcessDone from twisted.internet.defer import Deferred from twisted.internet.protocol import ProcessProtocol from twisted.protocols.basic import LineOnlyReceiver RUN_ACTION = ActionType( action_type="flocker.common.runner:run", startFields=[ Field.for_types(u"command", [list], u"The command.") ], successFields=[], description="Run a command.", ) RUN_OUTPUT_MESSAGE = MessageType( message_type="flocker.common.runner:run:stdout", fields=[ Field.for_types(u"line", [bytes], u"The output."), ], description=u"A line of command output.", ) RUN_ERROR_MESSAGE = MessageType( message_type="flocker.common.runner:run:stderr", fields=[ Field.for_types(u"line", [bytes], u"The error."),
""" Helper module to provide macros for logging support for storage drivers (AWS, Cinder). See https://clusterhq.atlassian.net/browse/FLOC-2053 for consolidation opportunities. """ from eliot import Field, ActionType, MessageType # Begin: Common structures used by all (AWS, OpenStack) # storage drivers. # An OPERATION is a list of: # IBlockDeviceAPI name, positional arguments, keyword arguments. OPERATION = Field.for_types( u"operation", [list], u"The IBlockDeviceAPI operation being executed," u"along with positional and keyword arguments.") # End: Common structures used by all storage drivers. # Begin: Helper datastructures to log IBlockDeviceAPI calls # from AWS storage driver using Eliot. # ActionType used by AWS storage driver. AWS_ACTION = ActionType( u"flocker:node:agents:blockdevice:aws", [OPERATION], [], u"An IBlockDeviceAPI operation is executing using AWS storage driver.") # Three fields to gather from EC2 response to Boto. AWS_CODE = Field.for_types("aws_code", [bytes, unicode], u"The error response code.")
u'txacme:jws:http:get', fields(), fields(), u'A JWSClient GET request') LOG_JWS_POST = ActionType( u'txacme:jws:http:post', fields(), fields(), u'A JWSClient POST request') LOG_JWS_REQUEST = ActionType( u'txacme:jws:http:request', fields(url=unicode), fields(Field.for_types(u'content_type', [unicode, None], u'Content-Type header field'), code=int), u'A JWSClient request') LOG_JWS_CHECK_RESPONSE = ActionType( u'txacme:jws:http:check-response', fields(Field.for_types(u'response_content_type', [unicode, None], u'Content-Type header field'), expected_content_type=unicode), fields(), u'Checking a JWSClient response') LOG_JWS_GET_NONCE = ActionType( u'txacme:jws:nonce:get',