4
# Copyright (C) 2009-2010 Canonical Ltd.
6
# Author: Scott Moser <scott.moser@canonical.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License version 3, as
10
# published by the Free Software Foundation.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
import cloudinit.CloudConfig
27
def Usage(out = sys.stdout):
28
out.write("Usage: %s name\n" % sys.argv[0])
31
# expect to be called with name of item to fetch
32
if len(sys.argv) != 2:
36
cc = cloudinit.CloudConfig.CloudConfig(cloudinit.cloud_config)
39
'user_data' : cc.cloud.get_userdata(),
40
'user_data_raw' : cc.cloud.get_userdata_raw(),
41
'instance_id' : cc.cloud.get_instance_id(),
44
name = sys.argv[1].replace('-','_')
47
sys.stderr.write("unknown name '%s'. Known values are:\n %s\n" %
48
(sys.argv[1], ' '.join(data.keys())))
54
if __name__ == '__main__':