swift-smf-method revision 2810
18920d790825d96ca3943aa2dcb6eb80dc611c5fTinderbox User# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
ab496cc3df1648e9ad992a87c35c2c0870fdc69dTinderbox User# Licensed under the Apache License, Version 2.0 (the "License"); you may
7c1468ed500356839a4a222517364e6ce18cb1a2Tinderbox User# not use this file except in compliance with the License. You may obtain
c57668a2fbbe558c1bd21652813616f2f517c469Tinderbox User# a copy of the License at
8de3f14f1c300c3e1ed99084cc03485b42c92bf1Tinderbox User# Unless required by applicable law or agreed to in writing, software
950d203b64f512b85fcc093ee1e9e3e531a1aea3Tinderbox User# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# License for the specific language governing permissions and limitations
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# under the License.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews "account-reaper": ["account", "container", "object"],
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews "proxy-server": ["account", "container", "object"]
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # All the Swift services do essentially the same thing, so there's no need
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # to have different method executables. Just look at the FMRI and run the
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # appropriate executable from /usr/lib/swift.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User exefile = os.path.basename(fmri.split(":")[1])
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews exepath = os.path.join("/usr/lib/swift", exefile)
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews # Try to find a config file that matches the executable name (minus the
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt # leading "swift-". If that fails, try using the -server config file.
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User cfgfile = "/etc/swift/%s.conf" % exepath.split("-", 1)[1]
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt cfgfile = "/etc/swift/%s-server.conf" % exepath.split("-")[1]
16f6050f29b6b0422cee858e609f65e474e70ef2Tinderbox User print >> sys.stderr, "Missing configuration file"
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater smf_include.smf_method_exit(smf_include.SMF_EXIT_ERR_CONFIG,
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt for ring in rings.get(exepath.split("-", 1)[1], ()):
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews print >> sys.stderr, "Missing ring(s): " + ", ".join(missing_rings)
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater smf_include.smf_method_exit(smf_include.SMF_EXIT_ERR_CONFIG,
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews "Missing ring(s): " + ", ".join(missing_rings))
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # This is the default recon_cache_path (from the config files) as well as
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater # the default run_dir (from the code).