Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
shape.stable_json
to handle special characters better
Test Plan: - `buck2 run global_services_index/administrator:tw.global_services_index.logview.cm=publish` doesn't error and produces `tw.global_services_index.logview.cm:MC0xTGdmNGV1V2JqcFJMVDVDMTR0MVp2N0xDZV9GOThnX3UtakNVNDdaTUEvNDQ0YTc0NGExYmViYmJlNTZiNzY1ZmQ4MjZkNzdhYTE` - `cm print tw.global_services_index.logview.cm:MC0xTGdmNGV1V2JqcFJMVDVDMTR0MVp2N0xDZV9GOThnX3UtakNVNDdaTUEvNDQ0YTc0NGExYmViYmJlNTZiNzY1ZmQ4MjZkNzdhYTE` and observe sane `pre_run_commands` ``` TaskContainerManifest { handle: ContainerManifestHandle { name: "tw.global_services_index.logview.cm", id: "MC0xTGdmNGV1V2JqcFJMVDVDMTR0MVp2N0xDZV9GOThnX3UtakNVNDdaTUEvNDQ0YTc0NGExYmViYmJlNTZiNzY1ZmQ4MjZkNzdhYTE", variant: None, labels: None, }, flavorToManifest: { "centos8": ContainerManifest { pkgs: [], directories: [], image: ContainerManifestImage { imageConfig: ImageConfig { fbpkg: Fbpkg { name: "tupperware.image.sendstream.base.c8", version: "1e4db2c093574fce7f52edb8b0abb7b5", preCompressedSizeBytes: 0, }, minRootfsSize: 0, filename: "", usesTwManagedImage: false, }, beingPushed: false, }, metadata: ContainerManifestMetadata { buildTarget: "fbcode//global_services_index/administrator:tw.global_services_index.logview.cm", revision: "6bf34acfcc0bf3b080590e83a80b61ca11a9b29c", }, rootfsOps: UnknownField( -1, ), runtimeConfig: Some( ContainerManifestRuntimeConfig { pre_run_commands: [ Command { command: "mkdir -p /var/tmp/logconsolidator/\ncat >/var/tmp/logconsolidator/config.py << EOF\ndef get_log_tuples(h, s, c):\n base_tuples = [('/logs/stderr', 'errorlog_global_services_index', 1, ('^((I|V)[0-9]{4} )',), 'ads_delivery.py', None), ('/logs/stderr', 'errorlog_global_services_index', 1, ('^(?!(I|V)[0-9]{4} )',), 'ads_delivery.py', None)]\n tier_tuples = {}\n env_var_tuples = {}\n import os\n return base_tuples + [\n tuple\n for tier in s if tier in tier_tuples\n for tuple in tier_tuples[tier]\n ] + [\n tuple\n for env_var, tuples in env_var_tuples.items()\n if os.environ.get(env_var)\n for tuple in tuples\n ]\nhostname_prefix_whitelist = []\nhostname_prefix_to_pools = {}\n\nEOF\n\n/packages/scribeclient2/logconsolidator_ctrl.par start", arguments: [], unix_user: Some( "nobody", ), capabilities: None, }, ], environment_variables: { "LOGCONSOLIDATOR_CONFIG": "/var/tmp/logconsolidator/config.py", }, command: Command { command: "", arguments: [], unix_user: Some( "nobody", ), capabilities: None, }, kill_command: None, kill_timeout: None, ports: Some( [], ), user_attributes: {}, log_policy: Some( LogPolicy { retentionDays: 30, retentionSize: 0, rotationSize: 0, rotationRate: 24, uploadPolicy: None, }, ), resource_limit: None, }, ), }, }, defaultFlavor: "centos8", mixins: [], oncall: "global_services_index", Reviewed By: sergeyfd Differential Revision: D47441722 fbshipit-source-id: 0faff10b0d3dc6251db59e42d7c27bcd4a8fc8d9
- Loading branch information