def _parse_update_options(self, args): is_valid = self._parse_command_options_common(args) if is_valid: if args.image is not None: prior_image = self.edge_config.deployment_config.edge_image if prior_image != args.image: try: self.edge_config.deployment_config.edge_image = args.image except ValueError as ex: msg = 'Error setting --image data: {0}. {1}'.format(args.image, ex) log.error(msg) raise edgectl.errors.EdgeError(msg, ex) EdgeHostPlatform.install_edge_by_json_data(self.edge_config, False) config_file = EdgeHostPlatform.get_host_config_file_path() log.info('The runtime configuration file %s was updated with' \ ' the new image: %s', config_file, args.image) return is_valid
def _parse_login_options(self, args): is_valid = self._parse_command_options_common(args) if is_valid: try: self.edge_config.deployment_config.add_registry( args.address, args.username, args.password) except ValueError as ex: log.error('%s', str(ex)) msg = EdgeUtils.sanitize_registry_data(args.address, args.username, args.password) log.error('Error setting login data: [%s].', msg) raise edgectl.errors.EdgeError('Error setting login data', ex) EdgeHostPlatform.install_edge_by_json_data(self.edge_config, False) config_file = EdgeHostPlatform.get_host_config_file_path() log.info('The runtime configuration file %s was updated with' \ ' the credentials for registry: %s', config_file, args.address) return is_valid
def _parse_and_validate_user_input(self, args): ip_type = EdgeConfigInputSources.CLI parser = EdgeConfigParserFactory.create_parser(ip_type, args) self.edge_config = parser.parse() EdgeHostPlatform.install_edge_by_json_data(self.edge_config, True) return True