@@ -37,36 +37,20 @@ class CreateAgent(command.ShowOne):
3737
3838 def get_parser(self, prog_name):
3939 parser = super(CreateAgent, self).get_parser(prog_name)
40- parser.add_argument(
41- "os",
42- metavar="<os>",
43- help=_("Type of OS")
44- )
40+ parser.add_argument("os", metavar="<os>", help=_("Type of OS"))
4541 parser.add_argument(
4642 "architecture",
4743 metavar="<architecture>",
48- help=_("Type of architecture")
49- )
50- parser.add_argument(
51- "version",
52- metavar="<version>",
53- help=_("Version")
54- )
55- parser.add_argument(
56- "url",
57- metavar="<url>",
58- help=_("URL")
59- )
60- parser.add_argument(
61- "md5hash",
62- metavar="<md5hash>",
63- help=_("MD5 hash")
44+ help=_("Type of architecture"),
6445 )
46+ parser.add_argument("version", metavar="<version>", help=_("Version"))
47+ parser.add_argument("url", metavar="<url>", help=_("URL"))
48+ parser.add_argument("md5hash", metavar="<md5hash>", help=_("MD5 hash"))
6549 parser.add_argument(
6650 "hypervisor",
6751 metavar="<hypervisor>",
6852 default="xen",
69- help=_("Type of hypervisor")
53+ help=_("Type of hypervisor"),
7054 )
7155 return parser
7256
@@ -78,7 +62,7 @@ def take_action(self, parsed_args):
7862 parsed_args.version,
7963 parsed_args.url,
8064 parsed_args.md5hash,
81- parsed_args.hypervisor
65+ parsed_args.hypervisor,
8266 )
8367 agent = compute_client.agents.create(*args)._info.copy()
8468 return zip(*sorted(agent.items()))
@@ -95,10 +79,7 @@ class DeleteAgent(command.Command):
9579 def get_parser(self, prog_name):
9680 parser = super(DeleteAgent, self).get_parser(prog_name)
9781 parser.add_argument(
98- "id",
99- metavar="<id>",
100- nargs='+',
101- help=_("ID of agent(s) to delete")
82+ "id", metavar="<id>", nargs='+', help=_("ID of agent(s) to delete")
10283 )
10384 return parser
10485
@@ -110,13 +91,17 @@ def take_action(self, parsed_args):
11091 compute_client.agents.delete(id)
11192 except Exception as e:
11293 result += 1
113- LOG.error(_("Failed to delete agent with ID '%(id)s': %(e)s"),
114- {'id': id, 'e': e})
94+ LOG.error(
95+ _("Failed to delete agent with ID '%(id)s': %(e)s"),
96+ {'id': id, 'e': e},
97+ )
11598
11699 if result > 0:
117100 total = len(parsed_args.id)
118- msg = (_("%(result)s of %(total)s agents failed "
119- "to delete.") % {'result': result, 'total': total})
101+ msg = _("%(result)s of %(total)s agents failed " "to delete.") % {
102+ 'result': result,
103+ 'total': total,
104+ }
120105 raise exceptions.CommandError(msg)
121106
122107
@@ -133,7 +118,7 @@ def get_parser(self, prog_name):
133118 parser.add_argument(
134119 "--hypervisor",
135120 metavar="<hypervisor>",
136- help=_("Type of hypervisor")
121+ help=_("Type of hypervisor"),
137122 )
138123 return parser
139124
@@ -146,13 +131,19 @@ def take_action(self, parsed_args):
146131 "Architecture",
147132 "Version",
148133 "Md5Hash",
149- "URL"
134+ "URL",
150135 )
151136 data = compute_client.agents.list(parsed_args.hypervisor)
152- return (columns,
153- (utils.get_item_properties(
154- s, columns,
155- ) for s in data))
137+ return (
138+ columns,
139+ (
140+ utils.get_item_properties(
141+ s,
142+ columns,
143+ )
144+ for s in data
145+ ),
146+ )
156147
157148
158149class SetAgent(command.Command):
@@ -165,26 +156,18 @@ class SetAgent(command.Command):
165156
166157 def get_parser(self, prog_name):
167158 parser = super(SetAgent, self).get_parser(prog_name)
168- parser.add_argument(
169- "id",
170- metavar="<id>",
171- help=_("ID of the agent")
172- )
159+ parser.add_argument("id", metavar="<id>", help=_("ID of the agent"))
173160 parser.add_argument(
174161 "--agent-version",
175162 dest="version",
176163 metavar="<version>",
177- help=_("Version of the agent")
164+ help=_("Version of the agent"),
178165 )
179166 parser.add_argument(
180- "--url",
181- metavar="<url>",
182- help=_("URL of the agent")
167+ "--url", metavar="<url>", help=_("URL of the agent")
183168 )
184169 parser.add_argument(
185- "--md5hash",
186- metavar="<md5hash>",
187- help=_("MD5 hash of the agent")
170+ "--md5hash", metavar="<md5hash>", help=_("MD5 hash of the agent")
188171 )
189172 return parser
190173
0 commit comments