AmbariConfig.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env python2.6
  2. '''
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing, software
  12. distributed under the License is distributed on an "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. See the License for the specific language governing permissions and
  15. limitations under the License.
  16. '''
  17. import logging
  18. import logging.handlers
  19. import ConfigParser
  20. import StringIO
  21. config = ConfigParser.RawConfigParser()
  22. content = """
  23. [server]
  24. url=http://localhost:4080
  25. [agent]
  26. prefix=/tmp/ambari
  27. [stack]
  28. installprefix=/var/ambari/
  29. [puppet]
  30. puppet_home=/usr/local/bin
  31. facter_home=/usr/local/bin
  32. [command]
  33. maxretries=2
  34. sleepBetweenRetries=1
  35. """
  36. s = StringIO.StringIO(content)
  37. config.readfp(s)
  38. class AmbariConfig:
  39. def getConfig(self):
  40. global config
  41. return config
  42. def setConfig(customConfig):
  43. global config
  44. config = customConfig
  45. def main():
  46. print config
  47. if __name__ == "__main__":
  48. main()