class Hello(MgrModule):
+ # these are CLI commands we implement
COMMANDS = [
{
"cmd": "hello "
},
]
+ # these are module options we understand. These can be set with
+ # 'ceph config set global mgr/hello/<name> <value>'. e.g.,
+ # 'ceph config set global mgr/hello/place Earth'
+ MODULE_OPTIONS = [
+ {
+ 'name': 'place',
+ 'default': 'world',
+ },
+ {
+ 'name': 'emphatic',
+ 'type': 'bool',
+ 'default': True,
+ },
+ ]
+
def __init__(self, *args, **kwargs):
super(Hello, self).__init__(*args, **kwargs)
status_code = 0
output_buffer = "Output buffer is for data results"
output_string = "Output string is for informative text"
- message = "hello world!"
-
if 'person_name' in cmd:
- message = "hello, " + cmd['person_name'] + "!"
+ message = "Hello, " + cmd['person_name']
+ else:
+ message = "Hello " + self.get_module_option('place');
+ if self.get_module_option('emphatic'):
+ message += '!'
return status_code, output_buffer, message + "\n" + output_string